-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (47 loc) · 1.74 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
cmake_minimum_required(VERSION 3.9)
project(EmiROOT VERSION 1.0.1 DESCRIPTION "EmiROOT: Evolutionary minimizer for ROOT")
include(GNUInstallDirs)
find_package(ROOT)
include_directories(include)
set(CMAKE_CXX_FLAGS "-std=c++17 -Werror -g -O3")
# list of source files
file(GLOB_RECURSE EmiROOT_SRC ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB EmiROOT_SRC_ROOT ${PROJECT_SOURCE_DIR}/ROOT/*.cc)
# list of headers
file(GLOB_RECURSE EmiROOT_INCLUDE ${PROJECT_SOURCE_DIR}/include/*.h)
file(GLOB_RECURSE EmiROOT_INCLUDE_ROOT ${PROJECT_SOURCE_DIR}/ROOT/*.h)
if(ROOT_FOUND)
###########################################
#### Compile EmiROOT with ROOT support ####
###########################################
message(STATUS "EmiROOT will be compiled with ROOT support")
add_library(EmiROOT SHARED ${EmiROOT_SRC} ${EmiROOT_SRC_ROOT})
include(${ROOT_USE_FILE})
target_link_libraries(EmiROOT ${ROOT_LIBRARIES})
set_target_properties(
EmiROOT PROPERTIES
PUBLIC_HEADER "${EmiROOT_INCLUDE};${EmiROOT_INCLUDE_ROOT}"
)
else()
##############################################
#### Compile EmiROOT without ROOT support ####
##############################################
message(WARNING "EmiROOT will be compiled without ROOT support")
add_library(EmiROOT SHARED ${EmiROOT_SRC})
set_target_properties(
EmiROOT PROPERTIES
PUBLIC_HEADER "${EmiROOT_INCLUDE}"
)
endif()
configure_file(macros/EmiROOT.pc.in EmiROOT.pc @ONLY)
target_include_directories(EmiROOT PRIVATE .)
install(
TARGETS EmiROOT
EXPORT EmiROOTTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/EmiROOT
)
install(
FILES ${CMAKE_BINARY_DIR}/EmiROOT.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
)