-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
61 lines (51 loc) · 1.68 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
cmake_minimum_required(VERSION 3.0.0)
project(dynalo)
#set(CMAKE_CXX_STANDARD 11 )
#set(CMAKE_CXX_STANDARD_REQUIRED ON )
#set(CMAKE_CXX_EXTENSIONS OFF)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>" # <prefix>/include
)
if (UNIX)
target_link_libraries(${PROJECT_NAME} INTERFACE dl)
elseif(WIN32)
target_link_libraries(${PROJECT_NAME} INTERFACE kernel32)
endif()
install(
DIRECTORY "include/${PROJECT_NAME}"
DESTINATION "include"
)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets)
include (CMakePackageConfigHelpers)
set(CONFIG_PACKAGE_BUILD_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")
set(CONFIG_PACKAGE_INSTALL_LOCATION "lib/cmake/${PROJECT_NAME}")
write_basic_package_version_file (
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION 1.0.3
COMPATIBILITY AnyNewerVersion
)
export(
EXPORT ${PROJECT_NAME}Targets
FILE "${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
)
configure_file(
"cmake/Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
@ONLY
)
install(
EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
#NAMESPACE ${PROJECT_NAME}::
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
install(
FILES
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}Config.cmake"
"${CONFIG_PACKAGE_BUILD_LOCATION}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CONFIG_PACKAGE_INSTALL_LOCATION}"
)
add_subdirectory(test)