-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
98 lines (75 loc) · 2.94 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
cmake_minimum_required(VERSION 3.12)
project(QnAnalysis CXX)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_VERSION 1.0)
include(ExternalProject)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Using C++${CMAKE_CXX_STANDARD}")
option(yaml-cpp_BUNDLED "Build bundled yaml-cpp" OFF)
option(QnAnalysis_BUILD_TESTS "Build tests" ON)
# by default build optimized code with debug symbols
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RELEASE)
endif ()
# in DEBUG mode make verbose Makefile
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif ()
set(EXTERNAL_DIR ${CMAKE_BINARY_DIR}/external)
set(EXTERNAL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/external)
set(QnAnalysis_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
include(FetchContent)
include(cmake_modules/YamlCpp.cmake)
include(cmake_modules/Root.cmake)
include(cmake_modules/QnTools.cmake)
include(cmake_modules/AnalysisTree.cmake)
include(cmake_modules/AnalysisTreeTaskSkeleton.cmake)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -g -DDEBUG -D__DEBUG -Wall")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ftree-vectorize -ffast-math -DNODEBUG")
message(STATUS "Using CXX flags for ${CMAKE_BUILD_TYPE}: ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
SET(QN_PATH "" CACHE STRING "Path to QnAnalysis")
list(APPEND CMAKE_PREFIX_PATH ${QN_PATH})
list(APPEND CMAKE_PREFIX_PATH $ENV{QN_PATH})
include_directories(${CMAKE_SOURCE_DIR}/src/base ${AnalysisTree_INCLUDE_DIR} ${PROJECT_INCLUDE_DIRECTORIES})
add_subdirectory(src)
add_subdirectory(test)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/QnAnalysis/QnAnalysisConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(EXPORT QnAnalysisTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/QnAnalysis/QnAnalysisTargets.cmake")
message(STATUS "QnAnalysisTargets: ${QnAnalysisTargets}")
set(ConfigPackageLocation lib/cmake/QnAnalysis)
set(QnAnalysis_INCLUDE_DIR "include")
set(QnAnalysis_LIBRARY_DIR "lib")
configure_file(QnAnalysisConfig.sh.in ${CMAKE_BINARY_DIR}/QnAnalysisConfig.sh)
configure_package_config_file(
QnAnalysisConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/QnAnalysis/QnAnalysisConfig.cmake
INSTALL_DESTINATION ${ConfigPackageLocation}
PATH_VARS QnAnalysis_INCLUDE_DIR QnAnalysis_LIBRARY_DIR
)
install(EXPORT QnAnalysisTargets
FILE
QnAnalysisTargets.cmake
DESTINATION
${ConfigPackageLocation}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/QnAnalysis/QnAnalysisConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/QnAnalysis/QnAnalysisConfigVersion.cmake"
DESTINATION
${ConfigPackageLocation}
COMPONENT
Devel
)
install(FILES
${CMAKE_BINARY_DIR}/QnAnalysisConfig.sh
DESTINATION
bin
COMPONENT
Devel
)