-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (55 loc) · 2.13 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
cmake_minimum_required(VERSION 3.20.0)
option(QUARTZLIB_GENERATE_CONFIGS "Enable generation of QuartzLibConfig.cmake" ON)
set(QUARTZLIB_INCLUDE_PREFIX "Quartz" CACHE STRING "Include prefix for installed headers")
project(QuartzLib
VERSION 1.1.0
DESCRIPTION "A simple library of tools created for use with the Quartz Engine"
HOMEPAGE_URL "https://github.com/NebulousDev/QuartzLib"
)
include(GNUInstallDirs)
add_library(${PROJECT_NAME} INTERFACE)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_include_directories(${PROJECT_NAME}
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
# Generate QuartzLibConfig.cmake
if(QUARTZLIB_GENERATE_CONFIGS)
include(CMakePackageConfigHelpers)
# Header-only cmake configs: https://dominikberner.ch/cmake-interface-lib/
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/CMake/Config.cmake.in"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}"
)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
NAMESPACE Quartz::
)
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
)
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/Include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${QUARTZMATH_INCLUDE_PREFIX}
)
message("[${PROJECT_NAME}] Generating config files...")
endif()