-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (56 loc) · 2.11 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
# Base CMakeLists file - set up all executables
# Setup the project
cmake_minimum_required(VERSION 3.10)
set(CMAKE_BUILD_TYPE None)
message("cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
message("cmake install prefix: ${CMAKE_INSTALL_PREFIX}")
message("source directory: ${CMAKE_CURRENT_SOURCE_DIR}")
project(doublecap VERSION 1.0
LANGUAGES CXX
DESCRIPTION "Geant4 project to simulate double-detector neutron-capture-induced defect formation measurement")
# for IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# 17 used for Geant 4-11.1-release
set(CMAKE_CXX_STANDARD 17)
option(IGNORE_WARNINGS "Ignore all warnings with -w flag" ON)
if (IGNORE_WARNINGS)
add_definitions(-w)
message(WARNING "Ignoring all warnings")
endif()
# =============================================
# Geant4
list(APPEND CMAKE_PREFIX_PATH "$ENV{G4INSTALL}")
find_package(Geant4 REQUIRED ui_all vis_all)
if (Geant4_FOUND)
message(STATUS "Libraries for Geant4 found")
message(STATUS "Input directory: " ${Geant4_DIR})
message(STATUS "Package Version: ${Geant4_VERSION}")
message(STATUS "Include DIRS: ${Geant4_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Failed to find Geant4.")
endif()
include("${Geant4_USE_FILE}")
# =============================================
# ROOT
list(APPEND CMAKE_PREFIX_PATH "$ENV{ROOTSYS}")
find_package(ROOT REQUIRED)
if (ROOT_FOUND)
message(STATUS "Libraries for ROOT found")
message(STATUS "Input directory: ${ROOT_DIR}")
message(STATUS "Package Version: ${ROOT_VERSION}")
message(STATUS "Include DIRS: ${ROOT_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Failed to find ROOT")
endif()
include("${ROOT_USE_FILE}")
# =============================================
# configure executables to all be put in base build directory
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
option(COPY_MACROS "Copy files from macros directory to build directory" ON)
if (COPY_MACROS)
message(STATUS "Copying macros to build directory")
execute_process(
COMMAND find ${CMAKE_SOURCE_DIR}/macros -type f -exec ln -sf "{}" ${CMAKE_BINARY_DIR} ";"
)
endif()
add_subdirectory(src)