cmake_minimum_required(VERSION 3.3 FATAL_ERROR) if(POLICY CMP0020) cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0071 NEW) endif() PROJECT(SideBySideRenderWindowsQt) if (VTK_VERSION VERSION_LESS "8.90.0") find_package(VTK COMPONENTS vtkCommonCore vtkFiltersCore vtkFiltersSources vtkInfovisCore vtkInteractionStyle vtkRenderingCore vtkRenderingFreeType vtkRenderingOpenGL2 vtkViewsQt) else() find_package(VTK COMPONENTS CommonCore FiltersCore FiltersSources InfovisCore InteractionStyle RenderingCore RenderingFreeType RenderingOpenGL2 ViewsQt) endif() if (NOT VTK_FOUND) message("Skipping SideBySideRenderWindowsQt: ${VTK_NOT_FOUND_MESSAGE}") return () endif() message (STATUS "VTK_VERSION: ${VTK_VERSION}") if(vtkGUISupportQt_LOADED OR TARGET VTK::GUISupportQt) if (VTK_VERSION VERSION_LESS "8.90.0") if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4") # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) # We have ui files, this will bring in the macro: qt5_wrap_ui find_package(Qt5Widgets REQUIRED QUIET) else() message(STATUS "Qt4 is not supported.") return() endif() else() # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) find_package(Qt5Widgets REQUIRED QUIET) endif() else() message(STATUS "GuiSupportQt not found.") return() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) file(GLOB UI_FILES *.ui) file(GLOB QT_WRAP *.h) file(GLOB CXX_FILES *.cxx) qt5_wrap_ui(UISrcs ${UI_FILES}) if (VTK_VERSION VERSION_LESS "8.90.0") # old system include(${VTK_USE_FILE}) # CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped. add_executable(SideBySideRenderWindowsQt MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP}) qt5_use_modules(SideBySideRenderWindowsQt Core Gui) target_link_libraries(SideBySideRenderWindowsQt ${VTK_LIBRARIES}) else() # CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped. add_executable(SideBySideRenderWindowsQt MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP}) qt5_use_modules(SideBySideRenderWindowsQt Core Gui) target_link_libraries(SideBySideRenderWindowsQt ${VTK_LIBRARIES}) # vtk_module_autoinit is needed vtk_module_autoinit( TARGETS SideBySideRenderWindowsQt MODULES ${VTK_LIBRARIES} ) endif()