File: CMakeLists.txt

package info (click to toggle)
vtk7 7.1.1%2Bdfsg2-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 127,396 kB
  • sloc: cpp: 1,539,584; ansic: 124,382; python: 78,038; tcl: 47,013; xml: 8,142; yacc: 5,040; java: 4,439; perl: 3,132; lex: 1,926; sh: 1,500; makefile: 126; objc: 83
file content (106 lines) | stat: -rw-r--r-- 2,804 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 2.8.8)
if(POLICY CMP0020)
  cmake_policy(SET CMP0020 NEW)
endif()
if(POLICY CMP0025)
  cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
if(POLICY CMP0043)
  cmake_policy(SET CMP0043 NEW) # CMake 3.0
endif()
if(POLICY CMP0053)
  cmake_policy(SET CMP0053 NEW) # CMake 3.1
endif()

project(CustomLinkView)

find_package(VTK REQUIRED)
vtk_module_config(VTK
  vtkCommonCore
  vtkCommonDataModel
  vtkFiltersGeneral
  vtkGUISupportQt
  vtkIOInfovis
  vtkInfovisCore
  vtkRendering${VTK_RENDERING_BACKEND}
  vtkViewsCore
  vtkViewsInfovis
  vtkViewsQt
)
include(${VTK_USE_FILE})

if("${VTK_QT_VERSION}" STREQUAL "")
  message(FATAL_ERROR "VTK was not built with Qt")
endif()

# Use the include path and library for Qt that is used by VTK.
include_directories(
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# Set your files and resources here
set(Srcs main.cxx CustomLinkView.cxx)
set(UIs CustomLinkView.ui)
set(Hdrs CustomLinkView.h)
set(MOC_Hdrs CustomLinkView.h)
set(Rcs Icons/icons.qrc)

# It is nice to have the ui in the windows project file.
# Right-click, choose Open With... press the Add button,
# and then find designer.exe and set as default.
# After this just click on it to bring it up in designer.
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
  set(Srcs ${Srcs} ${UIs})
endif(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")

if(VTK_QT_VERSION VERSION_GREATER "4")

  find_package(Qt5 COMPONENTS Widgets)

  qt5_wrap_ui(UI_Srcs ${UIs})
  qt5_add_resources(Rcs_Srcs ${Rcs})

  set_source_files_PROPERTIES(${Srcs} PROPERTIES
                              OBJECT_DEPENDS "${UI_Srcs}")

  add_executable(CustomLinkView
    MACOSX_BUNDLE  ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${Rcs_Srcs})

  qt5_use_modules(CustomLinkView Core Gui Widgets)

  target_link_libraries(CustomLinkView ${VTK_LIBRARIES})
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})

  # Use the include path and library for Qt that is used by VTK.
  include_directories(
    ${QT_INCLUDE_DIR}
  )

  qt4_wrap_ui(UI_Srcs ${UIs})
  qt4_add_resources(Rcs_Srcs ${Rcs})

  add_definitions(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
  set_source_files_PROPERTIES(${Srcs} PROPERTIES
                              OBJECT_DEPENDS "${UI_Srcs}")

  add_executable(CustomLinkView
    MACOSX_BUNDLE ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${Rcs_Srcs})

  target_link_libraries(CustomLinkView
    ${QT_LIBRARIES}
    ${VTK_LIBRARIES}
  )
endif()