-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
129 lines (82 loc) · 4.23 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
########################################################
# cmake file for building GEAR
# @author Jan Engels, Desy IT
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
########################################################
# project name
PROJECT( GEAR )
# project version
SET( ${PROJECT_NAME}_VERSION_MAJOR 1 )
SET( ${PROJECT_NAME}_VERSION_MINOR 9 )
SET( ${PROJECT_NAME}_VERSION_PATCH 3 )
cmake_policy(SET CMP0008 NEW)
### DEPENDENCIES ############################################################
FIND_PACKAGE( ILCUTIL COMPONENTS ILCSOFT_CMAKE_MODULES REQUIRED )
# load default settings from ILCSOFT_CMAKE_MODULES
INCLUDE( ilcsoft_default_settings )
# root is needed to build tgeo
OPTION( GEAR_TGEO "Set to ON to build tgeo (ROOT >= 5.27.06 required)" OFF )
# for backwards compatibility
IF( DEFINED BUILD_TGEO )
SET( GEAR_TGEO ${BUILD_TGEO} )
ENDIF()
IF( GEAR_TGEO )
# at least version 5.27.06 of ROOT is required for using GEAR_TGEO
FIND_PACKAGE( ROOT 5.27.06 REQUIRED COMPONENTS Gdml Geom XMLIO )
ENDIF( GEAR_TGEO )
FIND_PACKAGE( CLHEP REQUIRED ) # needed for gearsurf
# export CLHEP dependency to GEARConfig.cmake
SET( GEAR_DEPENDS_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} )
SET( GEAR_DEPENDS_LIBRARY_DIRS ${CLHEP_LIBRARY_DIRS} )
#SET( GEAR_DEPENDS_LIBRARIES ${CLHEP_LIBRARIES} )
#fg CLHEP exports only the IMPORT target for the library - here we need to get the actual file:
IF( TARGET CLHEP::CLHEP )
get_property( XX_clhep_lib TARGET CLHEP::CLHEP PROPERTY LOCATION_${CMAKE_BUILD_TYPE} )
MESSAGE(INFO "************** export CLHEP_LIBRARIES: ${XX_clhep_lib}" )
SET( GEAR_DEPENDS_LIBRARIES ${XX_clhep_lib})
ELSE()
SET( GEAR_DEPENDS_LIBRARIES ${CLHEP_LIBRARIES} )
ENDIF()
### DOCUMENTATION ###########################################################
OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" ON )
IF( INSTALL_DOC )
FIND_PACKAGE( Doxygen )
IF( DOXYGEN_FOUND )
ADD_SUBDIRECTORY( ./doc )
ELSE()
MESSAGE( SEND_ERROR "Could not find doxygen required to build documentation" )
MESSAGE( "Please install doxygen or set INSTALL_DOC to OFF" )
MESSAGE( "" )
ENDIF()
ENDIF()
#############################################################################
# -------- generate GearConfig.h ----------------------------------------------
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake/GearConfig.h.cmake.in"
"${PROJECT_BINARY_DIR}/gear/GearConfig.h" @ONLY )
INSTALL( FILES "${PROJECT_BINARY_DIR}/gear/GearConfig.h" DESTINATION "include/gear/" )
# -----------------------------------------------------------------------------
ADD_SUBDIRECTORY( ./src )
# install include files
INSTALL_DIRECTORY( ./include DESTINATION . FILES_MATCHING PATTERN "*.h" )
# ------- symlinks in include directory for backwards compatibility ---------
# FIXME: this symlinks are needed to build Mokka. Should fix this code in Mokka
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink gear/gearimpl gearimpl WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include )" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink gear/gearxml gearxml WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include )" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink gear/gearsurf gearsurf WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include )" )
IF( GEAR_TGEO )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink gear/geartgeo geartgeo WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include)" )
ENDIF()
ADD_CUSTOM_TARGET( uninstall_links
COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_INSTALL_PREFIX}/include/gearimpl"
COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_INSTALL_PREFIX}/include/gearxml"
COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_INSTALL_PREFIX}/include/gearsurf"
COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_INSTALL_PREFIX}/include/geartgeo"
)
ADD_DEPENDENCIES( uninstall uninstall_links )
# ---------------------------------------------------------------------------
# display some variables and write them to cache
DISPLAY_STD_VARIABLES()
MESSAGE( STATUS "GEAR_TGEO = ${GEAR_TGEO}" )
MESSAGE( STATUS )
# generate and install following configuration files
GENERATE_PACKAGE_CONFIGURATION_FILES( GEARConfig.cmake GEARConfigVersion.cmake )