-
Notifications
You must be signed in to change notification settings - Fork 25
/
CMakeLists.txt
110 lines (83 loc) · 3.68 KB
/
CMakeLists.txt
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
107
108
109
110
###########################################################
## CustusX project
###########################################################
project(CustusX)
#### Enable C++11
set (CMAKE_CXX_STANDARD 14)
cmake_minimum_required(VERSION 2.8.11)
# kill warning about mixing full and partial paths in libs:
# http://www.cmake.org/cmake/help/v2.8.10/cmake.html#policy%3aCMP0003
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/CMake)
include(cxUtilities)
include(cxInstallUtilities)
include(cxInitializeLibraries)
include(cxCatchUtilities)
include(cxGetVersion)
include(cxDocumentation)
#------------------------------------------------------------------------------
# Add some compiler flags (preprocessor definitions)
#------------------------------------------------------------------------------
cx_add_defintions()
cx_set_os_identifiers()
# _USE_MATH_DEFINES Must be defined before math.h is included
if (CX_WINDOWS)
add_definitions(-D_USE_MATH_DEFINES)
endif(CX_WINDOWS)
# required to compile some eigen code on at least Ubuntu
if(CX_LINUX)
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024 -no-pie")
endif(CX_LINUX)
if(SSC_PRINT_CALLER_INFO)
add_definitions(-DSSC_PRINT_CALLER_INFO)
endif()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared or static libs")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
# Use the old RPATH functionality that was the default in Ubuntu 16.04, instead of the new default: RUNPATH, or using LD_LIBRARY_PATH
if(CX_LINUX)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags")
endif(CX_LINUX)
message( STATUS "The " ${CMAKE_GENERATOR} " was used." )
#------------------------------------------------------------------------------
# Set CustusX version
#------------------------------------------------------------------------------
set(CX_SYSTEM_BASE_NAME "CustusX" CACHE STRING "base name of the installed system, use for root folder, version, installer..")
set(CX_SYSTEM_DEFAULT_APPLICATION "CustusX" CACHE STRING "The application to set as main installed app, must match an exe TARGET")
message(STATUS "Setting CX_SYSTEM_BASE_NAME=[${CX_SYSTEM_BASE_NAME}]")
message(STATUS "Setting CX_SYSTEM_DEFAULT_APPLICATION=[${CX_SYSTEM_DEFAULT_APPLICATION}]")
cx_read_version()
set(CMAKE_BUILD_TYPE:STRING=Debug)
cx_initialize_custusx_install()
cx_initialize_macosx_bundle()
cx_clear_catch_cache()
cx_initialize_coverage()
include(Dart)
#------------------------------------------------------------------------------
# Includes
#------------------------------------------------------------------------------
include_directories( /usr/local/include )
include_directories( /opt/local/include )
include_directories( /opt/X11/include )
#------------------------------------------------------------------------------
# Add subdirectories
#------------------------------------------------------------------------------
add_subdirectory( source )
add_subdirectory( doc ) # after plugins - uses global properties set there
#------------------------------------------------------------------------------
# CTest
#------------------------------------------------------------------------------
enable_testing()
#------------------------------------------------------------------------------
# Add non-source files
#------------------------------------------------------------------------------
cx_add_non_source_file("README.md")
cx_add_non_source_files_to_project_file()