-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
72 lines (59 loc) · 2.33 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
cmake_minimum_required(VERSION 3.5.0)
project(GARPLY VERSION 3.0.0)
include(GNUInstallDirs)
enable_testing()
add_subdirectory(garply)
add_subdirectory(tests)
include(CMakePackageConfigHelpers)
# * Versioning File (Same for Build/Install Trees)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/GarplyConfigVersion.cmake
VERSION
${GARPLY_VERSION}
COMPATIBILITY
ExactVersion)
# * Build Tree Config/Targets files
set(GARPLY_CURRENT_INCLUDEDIR "${PROJECT_SOURCE_DIR}")
set(GARPLY_CURRENT_LIBDIR "${PROJECT_BINARY_DIR}/garply")
configure_package_config_file(GarplyConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/GarplyConfig.cmake
INSTALL_DESTINATION
${CMAKE_CURRENT_BINARY_DIR}
INSTALL_PREFIX
${CMAKE_CURRENT_BINARY_DIR}
PATH_VARS
GARPLY_CURRENT_INCLUDEDIR
GARPLY_CURRENT_LIBDIR)
# NB: must be called *after* EXPORT argument is created, hence move of
# add_subdirectory earlier.
export(EXPORT GarplyTargets NAMESPACE garply::)
# * Install Tree Config/Targets file
set(GARPLY_CURRENT_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(GARPLY_CURRENT_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
configure_package_config_file(
GarplyConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/InstallTreeFiles/GarplyConfig.cmake
INSTALL_DESTINATION
${CMAKE_INSTALL_LIBDIR}/garply/cmake
PATH_VARS
GARPLY_CURRENT_INCLUDEDIR
GARPLY_CURRENT_LIBDIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/InstallTreeFiles/GarplyConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/GarplyConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/garply)
install(EXPORT GarplyTargets
NAMESPACE
garply::
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/garply)
# * Uninstall target
if(NOT TARGET uninstall)
configure_file("${CMAKE_CURRENT_LIST_DIR}/uninstall.cmake.in"
"${CMAKE_BINARY_DIR}/uninstall.cmake" IMMEDIATE
@ONLY)
add_custom_target(uninstall
COMMAND "${CMAKE_COMMAND}" -P
"${CMAKE_BINARY_DIR}/uninstall.cmake"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()