Commit 733ef2dd authored by Andrew Maclean's avatar Andrew Maclean
Browse files

Allow the examples to specify what modules to use.



This approach demonstrates good programming practice by only
linking to the needed modules.
It also removed the need to set CMP0020 to NEW in all cases
except those examples that link to Qt.

The include(${VTK_USE_FILE}) has been removed from the
top-level CMakeLists.txt file as it is unnecessary.

The solution presented here will work with the Examples built
as a stand-alone folder or within the VTK tree or with the
individual examples.

They have been tested on Linux, Windows VS2012 Express,
Mac OS-X 10.9 using Qt5.1.1.

Change-Id: I0572a395b2ebc6630db8c1407f410a584f668a85
Signed-off-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
parent 9594464d
...@@ -2,32 +2,23 @@ cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) ...@@ -2,32 +2,23 @@ cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
PROJECT (AMR) PROJECT (AMR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # remove if CMake >= 2.8.11 required
endif()
if(NOT VTK_SOURCE_DIR) if(NOT VTK_SOURCE_DIR)
message(ERROR "Cannot build AMR examples without VTK_SOURCE_DIR") message(ERROR " Cannot build AMR examples without VTK_SOURCE_DIR")
endif() endif()
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK COMPONENTS vtkCommonCore
vtkCommonCore vtkFiltersAMR
vtkCommonDataModel vtkFiltersExtraction
vtkCommonExecutionModel vtkFiltersGeometry
vtkFiltersAMR vtkFiltersSources
vtkFiltersCore vtkIOLegacy
vtkFiltersExtraction vtkIOXML
vtkFiltersGeneral vtkInteractionStyle
vtkFiltersGeometry vtkRenderingOpenGL
vtkFiltersSources vtkTestingCore
vtkIOXML
vtkRenderingCore
vtkRenderingOpenGL
vtkTestingCore
) )
include(${VTK_USE_FILE}) include(${VTK_USE_FILE})
endif()
include_directories( include_directories(
${VTK_SOURCE_DIR}/Testing/Core ${VTK_SOURCE_DIR}/Testing/Core
......
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # remove if CMake >= 2.8.11 required
endif()
PROJECT (LabeledMesh) PROJECT (LabeledMesh)
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK COMPONENTS vtkCommonCore
vtkCommonCore vtkCommonDataModel
vtkCommonDataModel vtkFiltersSources
vtkFiltersCore vtkInteractionStyle
vtkFiltersGeneral vtkRenderingLabel
vtkFiltersSources vtkRenderingOpenGL
vtkRenderingCore )
vtkRenderingLabel include(${VTK_USE_FILE})
vtkRenderingOpenGL
vtkRenderingFreeTypeOpenGL
)
include (${VTK_USE_FILE})
endif()
set(Libraries ${VTK_LIBRARIES})
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${PROJECT_NAME}.cxx) add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${PROJECT_NAME}.cxx)
target_link_libraries(${PROJECT_NAME} ${Libraries}) target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
...@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) ...@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8)
# Find and load VTK settings. # Find and load VTK settings.
if(NOT VTK_BINARY_DIR) if(NOT VTK_BINARY_DIR)
find_package(VTK 6.0 REQUIRED NO_MODULE) # find_package(VTK 6.1 REQUIRED NO_MODULE)
find_package(VTK vtkCommonCore)
include(${VTK_USE_FILE}) include(${VTK_USE_FILE})
endif() endif()
......
...@@ -10,20 +10,18 @@ else() ...@@ -10,20 +10,18 @@ else()
find_package(VTK REQUIRED) find_package(VTK REQUIRED)
endif() endif()
include(${VTK_USE_FILE})
if (NOT vtkRenderingCore_LOADED) if (NOT vtkRenderingCore_LOADED)
message(STATUS "vtkRenderingCore not found. No examples will be built") message(STATUS "vtkRenderingCore not found. No examples will be built")
else() else()
add_subdirectory(AMR/Cxx) add_subdirectory(AMR/Cxx)
add_subdirectory(Annotation/Cxx/LabeledMesh) add_subdirectory(Annotation/Cxx/LabeledMesh)
add_subdirectory(MultiBlock/Cxx)
add_subdirectory(DataManipulation/Cxx) add_subdirectory(DataManipulation/Cxx)
add_subdirectory(LIC/Cxx)
add_subdirectory(ImageProcessing/Cxx) add_subdirectory(ImageProcessing/Cxx)
add_subdirectory(IO/Cxx) add_subdirectory(IO/Cxx)
add_subdirectory(LIC/Cxx)
add_subdirectory(Medical/Cxx) add_subdirectory(Medical/Cxx)
add_subdirectory(Modelling/Cxx) add_subdirectory(Modelling/Cxx)
add_subdirectory(MultiBlock/Cxx)
add_subdirectory(Rendering/Cxx) add_subdirectory(Rendering/Cxx)
add_subdirectory(Tutorial/Step1/Cxx) add_subdirectory(Tutorial/Step1/Cxx)
add_subdirectory(Tutorial/Step2/Cxx) add_subdirectory(Tutorial/Step2/Cxx)
...@@ -34,10 +32,17 @@ else() ...@@ -34,10 +32,17 @@ else()
add_subdirectory(VisualizationAlgorithms/Cxx) add_subdirectory(VisualizationAlgorithms/Cxx)
add_subdirectory(VolumeRendering/Cxx) add_subdirectory(VolumeRendering/Cxx)
add_subdirectory(Widgets/Cxx) add_subdirectory(Widgets/Cxx)
add_subdirectory(Build/vtkLocal) # This may have been already built as part of the VTK build.
# If so we cannot create the target "vtkLocalExample" because
# an imported target of the same name already exists in the
# VTK build.
if(NOT vtkLocalExample_LOADED)
add_subdirectory(Build/vtkLocal)
endif()
if(TARGET vtkGUISupportQt) if(TARGET vtkGUISupportQt)
add_subdirectory(GUI/Qt) add_subdirectory(GUI/Qt)
endif() endif()
# add_subdirectory(Build/vtkMy) # add_subdirectory(Build/vtkMy)
# add_subdirectory(GUI/Motif) # add_subdirectory(GUI/Motif)
# IF(VTK_USE_PARALLEL) # IF(VTK_USE_PARALLEL)
......
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # remove if CMake >= 2.8.11 required
endif()
PROJECT (DataManipulation) PROJECT (DataManipulation)
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK COMPONENTS vtkCommonCore
vtkCommonCore vtkCommonDataModel
vtkCommonDataModel vtkFiltersGeometry
vtkFiltersCore vtkInteractionStyle
vtkFiltersGeometry vtkRenderingOpenGL
vtkRenderingCore
vtkRenderingOpenGL
vtkInteractionStyle
) )
include(${VTK_USE_FILE}) include(${VTK_USE_FILE})
endif()
add_executable(Arrays MACOSX_BUNDLE Arrays.cxx) add_executable(Arrays MACOSX_BUNDLE Arrays.cxx)
add_executable(Cube MACOSX_BUNDLE Cube.cxx) add_executable(Cube MACOSX_BUNDLE Cube.cxx)
......
add_subdirectory(ImageViewer)
add_subdirectory(SimpleView)
add_subdirectory(Events) add_subdirectory(Events)
add_subdirectory(FourPaneViewer) add_subdirectory(FourPaneViewer)
add_subdirectory(ImageViewer)
add_subdirectory(SimpleView)
if(TARGET vtkGUISupportQtOpenGL) if(TARGET vtkGUISupportQtOpenGL)
add_subdirectory(GraphicsView) add_subdirectory(GraphicsView)
......
...@@ -2,40 +2,21 @@ project(QtEvents) ...@@ -2,40 +2,21 @@ project(QtEvents)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
# Eliminate a warning when building in Windows that relates
# to static linking of Qt executables to qtmain.lib.
# This policy was introduced in CMake version 2.8.11.
# CMake version 2.8.11.2 warns when the policy is not set
# and uses OLD behavior.
if(POLICY CMP0020) if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
endif() endif()
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK) vtkCommonCore
if(NOT VTK_DIR) vtkFiltersSources
message(FATAL_ERROR "Please set VTK_DIR.") vtkGUISupportQt
endif() )
include(${VTK_USE_FILE}) include(${VTK_USE_FILE})
endif()
if("${VTK_QT_VERSION}" STREQUAL "") if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt") message(FATAL_ERROR "VTK was not built with Qt")
endif() endif()
if(VTK_QT_VERSION VERSION_GREATER "4")
# We have ui files, this will bring in the macro: qt5_wrap_ui
find_package(QT5Widgets REQUIRED QUIET)
else()
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
# Use what VTK built with
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
endif()
set( Srcs main.cxx GUI4.cxx ) set( Srcs main.cxx GUI4.cxx )
set( Hdrs GUI4.h ) set( Hdrs GUI4.h )
...@@ -54,19 +35,23 @@ include_directories( ...@@ -54,19 +35,23 @@ include_directories(
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
if(VTK_QT_VERSION VERSION_GREATER "4") if(VTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5Widgets)
qt5_wrap_ui(UI_Srcs ${UIs}) qt5_wrap_ui(UI_Srcs ${UIs})
add_executable(qtevents add_executable(qtevents
MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs}) MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs})
qt5_use_modules(qtevents Core Gui Widgets) qt5_use_modules(qtevents Core Gui Widgets)
target_link_libraries(qtevents ${VTK_LIBRARIES}) target_link_libraries(qtevents ${VTK_LIBRARIES})
else() else()
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
# Use what VTK built with
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
qt4_wrap_ui(UI_Srcs ${UIs}) qt4_wrap_ui(UI_Srcs ${UIs})
add_executable(qtevents MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs}) add_executable(qtevents MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs})
target_link_libraries(qtevents target_link_libraries(qtevents
${QT_LIBRARIES} ${QT_LIBRARIES}
${VTK_LIBRARIES} ${VTK_LIBRARIES}
......
...@@ -2,39 +2,24 @@ project(QtVTKRenderWindows) ...@@ -2,39 +2,24 @@ project(QtVTKRenderWindows)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
# Eliminate a warning when building in Windows that relates
# to static linking of Qt executables to qtmain.lib.
# This policy was introduced in CMake version 2.8.11.
# CMake version 2.8.11.2 warns when the policy is not set
# and uses OLD behavior.
if(POLICY CMP0020) if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
endif() endif()
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK) vtkCommonCore
if(NOT VTK_DIR) vtkFiltersSources
message(FATAL_ERROR "Please set VTK_DIR.") vtkGUISupportQt
endif() vtkIOImage
include(${VTK_USE_FILE}) vtkInteractionImage
endif() )
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "") if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt") message(FATAL_ERROR "VTK was not built with Qt")
endif() endif()
if(VTK_QT_VERSION VERSION_GREATER "4")
# We have ui files, this will bring in the macro: qt5_wrap_ui
find_package(QT5Widgets REQUIRED QUIET)
else()
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
# Use what VTK built with
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
endif()
# Set your files and resources here # Set your files and resources here
set( Srcs QtVTKRenderWindowsApp.cxx QtVTKRenderWindows.cxx) set( Srcs QtVTKRenderWindowsApp.cxx QtVTKRenderWindows.cxx)
...@@ -53,22 +38,22 @@ include_directories( ...@@ -53,22 +38,22 @@ include_directories(
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
if(VTK_QT_VERSION VERSION_GREATER "4") if(VTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5Widgets REQUIRED QUIET)
qt5_wrap_ui(UI_Srcs ${UIs}) qt5_wrap_ui(UI_Srcs ${UIs})
# CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped. # CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped.
add_executable(QtVTKRenderWindows ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs}) add_executable(QtVTKRenderWindows ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs})
qt5_use_modules(QtVTKRenderWindows Core Gui Widgets) qt5_use_modules(QtVTKRenderWindows Core Gui Widgets)
target_link_libraries(QtVTKRenderWindows ${VTK_LIBRARIES}) target_link_libraries(QtVTKRenderWindows ${VTK_LIBRARIES})
else() else()
include_directories( find_package(Qt4 REQUIRED)
${QT_INCLUDE_DIR} include(${QT_USE_FILE})
) # Use what VTK built with
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
qt4_wrap_ui(UI_Srcs ${UIs}) qt4_wrap_ui(UI_Srcs ${UIs})
add_executable(QtVTKRenderWindows ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs}) add_executable(QtVTKRenderWindows ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs})
target_link_libraries(QtVTKRenderWindows ${QT_LIBRARIES} ${VTK_LIBRARIES}) target_link_libraries(QtVTKRenderWindows ${QT_LIBRARIES} ${VTK_LIBRARIES})
endif() endif()
...@@ -2,35 +2,26 @@ project( GraphicsView ) ...@@ -2,35 +2,26 @@ project( GraphicsView )
cmake_minimum_required(VERSION 2.8.8) cmake_minimum_required(VERSION 2.8.8)
# Eliminate a warning when building in Windows that relates
# to static linking of Qt executables to qtmain.lib.
# This policy was introduced in CMake version 2.8.11.
# CMake version 2.8.11.2 warns when the policy is not set
# and uses OLD behavior.
if(POLICY CMP0020) if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
endif() endif()
find_package(OpenGL) find_package(OpenGL)
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK REQUIRED) vtkCommonCore
include(${VTK_USE_FILE}) vtkGUISupportQt
endif() vtkGUISupportQtOpenGL
vtkIOInfovis
vtkRenderingFreeTypeOpenGL
vtkViewsInfovis
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "") if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt") message(FATAL_ERROR "VTK was not built with Qt")
endif() endif()
if(VTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5WebKitWidgets REQUIRED QUIET)
else()
find_package(Qt4 REQUIRED)
set(QT_USE_QTOPENGL 1)
set(QT_USE_QTWEBKIT 1)
include(${QT_USE_FILE})
endif()
set( Srcs set( Srcs
main.cpp main.cpp
OpenGLScene.cpp OpenGLScene.cpp
...@@ -62,16 +53,20 @@ set( QRCs ...@@ -62,16 +53,20 @@ set( QRCs
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
if(VTK_QT_VERSION VERSION_GREATER "4") if(VTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5WebKitWidgets REQUIRED QUIET)
qt5_add_resources(QRC_Srcs ${QRCs} ) qt5_add_resources(QRC_Srcs ${QRCs} )
add_executable(qtgraphicsview MACOSX_BUNDLE add_executable(qtgraphicsview MACOSX_BUNDLE
${Srcs} ${Hdrs} ${MOC_Hdrs} ${QRC_Srcs}) ${Srcs} ${Hdrs} ${MOC_Hdrs} ${QRC_Srcs})
qt5_use_modules(qtgraphicsview Core Gui Widgets qt5_use_modules(qtgraphicsview Core Gui Widgets
WebKit WebKitWidgets OpenGL OpenGLExtensions) WebKit WebKitWidgets OpenGL OpenGLExtensions)
target_link_libraries(qtgraphicsview ${VTK_LIBRARIES}) target_link_libraries(qtgraphicsview ${VTK_LIBRARIES})
else() else()
find_package(Qt4 REQUIRED)
set(QT_USE_QTOPENGL 1)
set(QT_USE_QTWEBKIT 1)
include(${QT_USE_FILE})
if (NOT QT_QTWEBKIT_FOUND OR QT_VERSION_MINOR LESS 6) if (NOT QT_QTWEBKIT_FOUND OR QT_VERSION_MINOR LESS 6)
message(STATUS "VTK isn't configured to use QtOpenGL, QtWebKit wasn't found, or Qt 4.6 wasn't found. GraphicsView example is disabled.") message(STATUS "VTK isn't configured to use QtOpenGL, QtWebKit wasn't found, or Qt 4.6 wasn't found. GraphicsView example is disabled.")
else() else()
...@@ -79,7 +74,6 @@ else() ...@@ -79,7 +74,6 @@ else()
qt4_wrap_cpp(MOC_Srcs ${MOC_Hdrs}) qt4_wrap_cpp(MOC_Srcs ${MOC_Hdrs})
add_executable(qtgraphicsview ${Srcs} ${Hdrs} ${MOC_Hdrs} ${QRC_Srcs}) add_executable(qtgraphicsview ${Srcs} ${Hdrs} ${MOC_Hdrs} ${QRC_Srcs})
target_link_libraries(qtgraphicsview ${QT_LIBRARIES} ${VTK_LIBRARIES}) target_link_libraries(qtgraphicsview ${QT_LIBRARIES} ${VTK_LIBRARIES})
endif() endif()
endif() endif()
...@@ -2,29 +2,31 @@ project(QtImageViewer) ...@@ -2,29 +2,31 @@ project(QtImageViewer)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
# Eliminate a warning when building in Windows that relates
# to static linking of Qt executables to qtmain.lib.
# This policy was introduced in CMake version 2.8.11.
# CMake version 2.8.11.2 warns when the policy is not set
# and uses OLD behavior.
if(POLICY CMP0020) if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
endif() endif()
if(NOT VTK_BINARY_DIR) find_package(VTK COMPONENTS
find_package(VTK) vtkGUISupportQt
if(NOT VTK_DIR) vtkIOImage
message(FATAL_ERROR "Please set VTK_DIR.") vtkInteractionImage
endif() vtkRenderingOpenGL
include(${VTK_USE_FILE}) vtkTestingCore
endif() )
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "") if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt") message(FATAL_ERROR "VTK was not built with Qt")
endif() endif()
set( Srcs main.cxx )
if(VTK_QT_VERSION VERSION_GREATER "4") if(VTK_QT_VERSION VERSION_GREATER "4")
find_package(Qt5Core REQUIRED QUIET) find_package(Qt5Core REQUIRED QUIET)
add_executable(qtimageviewer ${Srcs})
qt5_use_modules(qtimageviewer Core Gui Widgets)
target_link_libraries(qtimageviewer ${VTK_LIBRARIES})
else() else()
find_package(Qt4 REQUIRED) find_package(Qt4 REQUIRED)
include(${QT_USE_FILE}) include(${QT_USE_FILE})
...@@ -32,22 +34,8 @@ else() ...@@ -32,22 +34,8 @@ else()
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "") set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "") set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "") set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
endif() include_directories(${QT_INCLUDE_DIR})
set( Srcs main.cxx )
if(VTK_QT_VERSION VERSION_GREATER "4")
add_executable(qtimageviewer ${Srcs}) add_executable(qtimageviewer ${Srcs})
qt5_use_modules(qtimageviewer Core Gui Widgets)
target_link_libraries(qtimageviewer ${VTK_LIBRARIES})
else()
include_directories(
${QT_INCLUDE_DIR}
)
add_executable(qtimageviewer ${Srcs})
target_link_libraries(qtimageviewer ${QT_LIBRARIES} ${VTK_LIBRARIES}) target_link_libraries(qtimageviewer ${QT_LIBRARIES} ${VTK_LIBRARIES})
endif() endif()
...@@ -2,39 +2,24 @@ project(SimpleView) ...@@ -2,39 +2,24 @@ project(SimpleView)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)