-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
91 lines (58 loc) · 1.73 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
cmake_minimum_required(VERSION 3.12)
# cmake
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
# config
include(RoqConfig)
# version (using git tag)
include(GetGitRepoVersion)
message("Using GIT_REPO_VERSION=${GIT_REPO_VERSION}")
# project
project(roq-flags VERSION ${GIT_REPO_VERSION})
# language
enable_language(CXX)
# filesystem
include(GNUInstallDirs)
# dependencies
find_package(absl REQUIRED)
find_package(ctre REQUIRED)
find_package(fmt REQUIRED)
find_package(roq-api REQUIRED)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
if(BUILD_TESTING)
find_package(Catch2 REQUIRED)
endif()
# include
include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
# sub-projects
add_subdirectory(${CMAKE_SOURCE_DIR}/src/roq/flags)
if(BUILD_TESTING)
add_subdirectory(${CMAKE_SOURCE_DIR}/test)
endif()
# install (public headers)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include/roq/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/roq
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "CMakeFiles" EXCLUDE)
# doxygen
option(BUILD_DOCS "Enable doxygen" OFF)
if(BUILD_DOCS)
find_package(Doxygen)
add_subdirectory(${CMAKE_SOURCE_DIR}/doxygen)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-doxygen)
endif()
# install (cmake)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-config)
install(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${PROJECT_NAME})
set(ROQ_FLAGS_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
export(
TARGETS ${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE ${ROQ_FLAGS_CMAKE_DIR}/${PROJECT_NAME}-config.cmake)
install(
EXPORT ${PROJECT_NAME}-config
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${ROQ_FLAGS_CMAKE_DIR})