-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
154 lines (126 loc) · 5.2 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#-----------------------------------------------------------------------
# - Top Level CMakeLists.txt for Geant4 Build
#
# 21st September 2010 Ben Morgan
#
# $Id: CMakeLists.txt 97459 2016-06-03 09:28:04Z gcosmo $
#
#-----------------------------------------------------------------------
# - Enforce an out-of-source builds before anything else
#
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Geant4 requires an out-of-source build.")
message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
message(STATUS "CMakeCache.txt")
message(STATUS "CMakeFiles")
message(STATUS "Once these files are removed, create a separate directory")
message(STATUS "and run CMake from there")
message(FATAL_ERROR "in-source build detected")
endif()
#-----------------------------------------------------------------------
# - Define CMake requirements and override make rules as needed
#
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
# - Any policy requirements should go here
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_SOURCE_DIR}/cmake/Modules/Geant4MakeRules_cxx.cmake)
#-----------------------------------------------------------------------
# - Project definition and basic configuration
#
project(Geant4)
# - Versioning. We do this here for now
set(${PROJECT_NAME}_VERSION "10.2.2")
set(${PROJECT_NAME}_VERSION_MAJOR "10")
set(${PROJECT_NAME}_VERSION_MINOR "2")
set(${PROJECT_NAME}_VERSION_PATCH "2")
# - Prepend our own CMake Modules to the search path
# NB: if our custom modules include others that we don't supply, those in
# the base path will be used, so watch for incompatibilities!!
#
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
${CMAKE_MODULE_PATH})
#-----------------------------------------------------------------------
# - Add functionality provided by standard and custom modules
# See the documentation in each of these modules for further details.
#
# - Provide dependent options as these are needed for some Geant4 features
include(CMakeDependentOption)
# - Provide general CMake utilities for Geant4.
include(Geant4MacroUtilities)
# - Provide an 'uninstall' target.
include(CMakeUninstallTarget)
# - Provide the 'validate_sources' target.
include(Geant4ValidateSources)
# - Provide standard install directories permitting customization.
include(Geant4InstallDirs)
# - Provide options to control how Geant4 libraries are built
include(Geant4LibraryBuildOptions)
# - Provide interface to control use of optional components
include(Geant4OptionalComponents)
# - Provide interface to control use of UI/Vis components
# Written in a separate module from other optional components because
# there are many complex options to handle.
include(Geant4InterfaceOptions)
# - Provide options to enable wrapping of Geant4 by other languages
include(Geant4Wrapping)
#-----------------------------------------------------------------------
# Add the source and environments subdirectories
# source : Process all the Geant4 core targets
# environments : Process optional wrappings of Geant4 (NOTYETIMPLEMENTED)
add_subdirectory(source)
#add_subdirectory(environments)
#-----------------------------------------------------------------------
# - Perform all post build tasks
# At the CMake level, this simply means that we must know about targets
# and other properties processed in source and environments trees before
# these tasks can be performed.
#
# - Installation of optional read-only architecture independent data files.
# E.g. Examples, data libraries, documentation.
# Done before toolchain generation because it may affect what we have to do
# there!
#
include(Geant4InstallData)
# - Generate any Use/Config/Support files here once everything else has
# been processed e.g. "UseGeant4.cmake", "Geant4Config.cmake", library
# dependencies etc.
# - Geant4Make
include(Geant4ToolchainBackwardCompatibility)
# - 'geant4-config'
include(Geant4ConfigureConfigScript)
# - Geant4Config.cmake
include(Geant4BuildProjectConfig)
#-----------------------------------------------------------------------
# - Testing configuration.
# Done here, as projects under 'tests' require Geant4Config.
if(GEANT4_ENABLE_TESTING)
include(Geant4CTest)
add_subdirectory(tests)
if(EXISTS ${CMAKE_SOURCE_DIR}/benchmarks)
add_subdirectory(benchmarks)
endif()
endif()
#-----------------------------------------------------------------------
# - Examples build/install
# NB: Build of examples is a *testing* proceedure. It is *not* intended
# that examples be built and installed as part of a full Geant4 install.
if(GEANT4_BUILD_EXAMPLES)
set(Geant4_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Current build directory")
add_subdirectory(examples)
endif()
# - Install example code to datarootdir
install(DIRECTORY examples
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/Geant4-${Geant4_VERSION}
COMPONENT Examples
PATTERN "CVS" EXCLUDE
PATTERN ".svn" EXCLUDE
)
#-----------------------------------------------------------------------
# - CPack-aging
include(Geant4CPackBase)
#-----------------------------------------------------------------------
# Final output - show what's been enabled so that user knows what's
# happening - also useful for later problem solving!
#
GEANT4_PRINT_ENABLED_FEATURES()