forked from iLCSoft/KiTrack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
108 lines (65 loc) · 2.94 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
########################################################
# cmake file for building Marlin example Package
# @author Jan Engels, Desy IT
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
########################################################
# project name
PROJECT( KiTrack )
# project version
SET( ${PROJECT_NAME}_VERSION_MAJOR 1 )
SET( ${PROJECT_NAME}_VERSION_MINOR 10 )
SET( ${PROJECT_NAME}_VERSION_PATCH 0 )
cmake_policy(SET CMP0008 NEW)
# By default build shared libraries but allow the user to change if desired
OPTION(BUILD_SHARED_LIBS "Global flag to cause add_library to create shared libraries if on" ON)
SET(CMAKE_CXX_STANDARD 11)
FIND_PACKAGE( ROOT REQUIRED )
INCLUDE_DIRECTORIES( ${ROOT_INCLUDE_DIRS} )
LINK_LIBRARIES( ${ROOT_LIBRARIES} )
ADD_DEFINITIONS( ${ROOT_DEFINITIONS} )
### DOCUMENTATION ###########################################################
OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF )
IF( INSTALL_DOC AND EXISTS "${PROJECT_SOURCE_DIR}/doc/CMakeLists.txt" )
ADD_SUBDIRECTORY( ./doc )
ENDIF()
### LIBRARY #################################################################
# definitions to pass to the compiler
#ADD_DEFINITIONS( "-Wall -ansi -pedantic" )
#ADD_DEFINITIONS( "-Wno-long-long" )
# include directories
INCLUDE_DIRECTORIES( BEFORE
./include
)
INSTALL( DIRECTORY ./include DESTINATION . FILES_MATCHING PATTERN "*.h" )
# add library
AUX_SOURCE_DIRECTORY( ./src/marlin library_sources )
AUX_SOURCE_DIRECTORY( ./src/Criteria library_sources )
AUX_SOURCE_DIRECTORY( ./src/KiTrack library_sources )
ADD_LIBRARY( ${PROJECT_NAME} ${library_sources} )
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION lib )
### TESTING #################################################################
MACRO( ADD_UNIT_TEST _name )
IF( BUILD_TESTING )
ADD_EXECUTABLE( test_${_name} ${ARGN} )
ELSE()
ADD_EXECUTABLE( test_${_name} EXCLUDE_FROM_ALL ${ARGN} )
ENDIF()
TARGET_LINK_LIBRARIES( test_${_name} ${PROJECT_NAME} )
GET_TARGET_PROPERTY( _executable test_${_name} LOCATION )
ADD_TEST( t_${_name} ${_executable} )
ENDMACRO()
INCLUDE_DIRECTORIES( ${ILCTEST_INCLUDE_DIRS} )
# ADD_UNIT_TEST( simple_circle ./src/testing/test_simple_circle.cc )
# SET_TESTS_PROPERTIES( t_simple_circle PROPERTIES FAIL_REGULAR_EXPRESSION "TEST_FAILED" )
# SET_TESTS_PROPERTIES( t_simple_circle PROPERTIES PASS_REGULAR_EXPRESSION "TEST_PASSED" )
# SET_TESTS_PROPERTIES( t_simple_circle PROPERTIES WILL_FAIL TRUE )
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY
)
INSTALL( FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" DESTINATION . )
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" @ONLY
)
INSTALL( FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION . )