-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
88 lines (66 loc) · 1.86 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
cmake_minimum_required(VERSION 3.8)
if(POLICY CMP0090)
cmake_policy(SET CMP0090 NEW)
endif()
project(Cougar VERSION 1.0.0 LANGUAGES CXX)
option(HMCGR_TESTING "Enable testing" OFF)
## option(HMCGR_EXAMPLES "Build Examples" OFF)
## option(HMCGR_BENCHMARKS "Build Benchmarks" OFF)
if(HMCGR_TESTING)
enable_testing()
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
include(CheckSymbolExists)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(HMCGRTargetDataFiles)
# Build Cougar library
check_symbol_exists(clock_gettime "time.h" HMCGR_HAVE_CLOCK_GETTIME)
find_package(Threads REQUIRED)
# Installation
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/Cougar
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT dev
)
## pkgconfig file
if(UNIX AND NOT APPLE)
set(TAADPOOL_PKG_EXTRA_LIBS " -lpthread -lrt")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Cougar.pc.in
Cougar.pc
@ONLY
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/Cougar.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
## CMake config files
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CougarConfig.cmake.in
CougarConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cougar
)
write_basic_package_version_file(
CougarConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
EXPORT CougarExport
NAMESPACE Cougar::
FILE CougarTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cougar
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/CougarConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/CougarConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cougar
)
export(PACKAGE Cougar)
# Tests
if(HMCGR_TESTING)
add_subdirectory(test)
endif()