-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (67 loc) · 2.6 KB
/
Copy pathCMakeLists.txt
File metadata and controls
81 lines (67 loc) · 2.6 KB
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
cmake_minimum_required(VERSION 3.5)
project(hcana VERSION 1.5 LANGUAGES CXX)
option(HCANA_BUILTIN_PODD "Use built-in Podd submodule (default: YES)" ON)
#----------------------------------------------------------------------------
# Set up Podd and ROOT dependencies
if(HCANA_BUILTIN_PODD)
list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/podd/cmake/Modules")
include(PoddCMakeEnv)
find_package(ROOT 6.00 REQUIRED)
config_add_dependency(ROOT 6.00)
else()
# Find Podd and register it as a dependency
# This will also automatically set up ROOT
find_package(Podd 1.7 REQUIRED)
include(PoddCMakeEnv)
config_add_dependency(Podd 1.7)
endif()
#----------------------------------------------------------------------------
# Install in GNU-style directory layout
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/${MAIN_PROJECT_NAME_LC})
if(PODD_SET_RPATH)
set_install_rpath()
endif()
#----------------------------------------------------------------------------
# Set up the compiler flags
set_compiler_flags("${ROOT_CXX_FLAGS}")
set_diagnostic_flags(WALL WEXTRA)
report_build_info()
#----------------------------------------------------------------------------
# Directories in which we build things
if(HCANA_BUILTIN_PODD)
add_subdirectory(podd)
endif()
add_subdirectory(src)
add_subdirectory(cmake)
#----------------------------------------------------------------------------
# Optional features: JSON export and CCDB
include(CheckIncludeFileCXX)
option(HCANA_WITH_JSON "Enable JSON export of THcParmList (gHcParms)" ON)
option(HCANA_JSON_EXPORT_STRINGS
"Export Textvars strings in JSON (requires newer Podd Textvars API)" OFF)
option(HCANA_WITH_CCDB "Enable CCDB support in THcParmList" OFF)
# If ROOT (or your system) exposes nlohmann/json.hpp via the include path,
# this check will succeed. ROOT 6.x vendors nlohmann::json internally, and
# many builds install <nlohmann/json.hpp> in the standard include path.
# Let the check see the same includes as normal code; ROOT_INCLUDE_DIRS is
# set by ROOT/Podd CMake.
if(DEFINED ROOT_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${ROOT_INCLUDE_DIRS}")
endif()
if(HCANA_WITH_JSON)
check_include_file_cxx("nlohmann/json.hpp" HCANA_HAVE_NLOHMANN_JSON)
if(NOT HCANA_HAVE_NLOHMANN_JSON)
message(WARNING
"HCANA_WITH_JSON=ON but <nlohmann/json.hpp> not found. "
"Disabling JSON export of THcParmList.")
set(HCANA_WITH_JSON OFF)
endif()
endif()
# These are the actual preprocessor symbols your code uses
if(HCANA_WITH_JSON)
add_compile_definitions(WITH_JSON)
endif()
if(HCANA_WITH_CCDB)
add_compile_definitions(WITH_CCDB)
endif()