-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (50 loc) · 1.57 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
cmake_minimum_required(VERSION 3.5)
project(libpi VERSION 1.0.0 LANGUAGES CXX)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
add_library(pi
src/pi.cpp
)
add_library(Pi::pi ALIAS pi)
target_include_directories(pi
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_features(pi PRIVATE cxx_auto_type)
target_compile_options(pi PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wall>)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Pi)
install(TARGETS pi
EXPORT pi-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
set_target_properties(pi PROPERTIES EXPORT_NAME Pi)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT pi-targets
FILE
PiTargets.cmake
NAMESPACE
Pi::
DESTINATION
${INSTALL_CONFIGDIR}
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/PiConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/PiConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/PiConfig.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/PiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/PiConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR}
)
export(EXPORT pi-targets FILE ${CMAKE_CURRENT_BINARY_DIR}/PiTargets.cmake NAMESPACE Pi::)
export(PACKAGE Pi)