-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (34 loc) · 1.09 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
cmake_minimum_required(VERSION 3.15)
project(hello_lib)
add_library(hello_lib STATIC src/hello.cpp)
target_include_directories(hello_lib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:src>
)
include(GNUInstallDirs)
install(TARGETS hello_lib
EXPORT hello_libTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION src
)
install(EXPORT hello_libTargets
FILE hello_libTargets.cmake
NAMESPACE hello_lib::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hello_lib
)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/hello_libConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/hello_libConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hello_lib
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/hello_libConfig.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hello_lib
)
install(
DIRECTORY src/
DESTINATION ${CMAKE_INSTALL_PREFIX}/src
FILES_MATCHING PATTERN "*.h*"
)