-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
93 lines (71 loc) · 2.72 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
cmake_minimum_required(VERSION 3.24)
if (NOT DEFINED GLAD_VERSION)
set(GLAD_VERSION 0.2.0)
endif()
set(GLAD_VERSION_STR \"${GLAD_VERSION}\")
project(glad
DESCRIPTION "A header-only library with some useful algorithms for asio"
HOMEPAGE_URL https://github.com/jgaa/glad
VERSION ${GLAD_VERSION}
LANGUAGES CXX)
set(GLAD_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
option(GLAD_WITH_TESTS "Enable Tests" ON)
option(GLAD_WITH_EXAMPLES "Enable Examples" ON)
option(GLAD_USE_STD_UNORDERED_MAP "Use std::unordered_map for the cache" OFF)
option(GLAD_USE_BOOST_FLAT_UNORDERED_MAP "Use boost::unordered_flat_map for the cache" OFF)
if (GLAD_USE_STD_UNORDERED_MAP AND GLAD_USE_BOOST_FLAT_UNORDERED_MAP)
message(FATAL_ERROR "You can use GLAD_USE_STD_UNORDERED_MAP or GLAD_USE_BOOST_FLAT_UNORDERED_MAP")
endif()
if (GLAD_USE_STD_UNORDERED_MAP)
set(JGAA_GLAD_MAP_TYPE std::unordered_map)
endif()
if (GLAD_USE_BOOST_FLAT_UNORDERED_MAP)
set(JGAA_GLAD_MAP_TYPE boost::unordered_flat_map)
endif()
if (GLAD_WITH_TESTS)
find_package(GTest REQUIRED)
endif()
if(NOT DEFINED USE_BOOST_VERSION)
set(USE_BOOST_VERSION 1.81)
endif()
find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
system
program_options
date_time
coroutine
context
chrono
)
include(GNUInstallDirs)
add_library(${PROJECT_NAME} INTERFACE
#include/glad/AsyncCache.hpp
)
target_include_directories( ${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/config.h.template ${CMAKE_BINARY_DIR}/generated-include/${PROJECT_NAME}/config.h)
if (GLAD_WITH_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if (GLAD_WITH_EXAMPLES)
add_subdirectory(examples)
endif()
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME} DESTINATION include)
install(DIRECTORY ${CMAKE_BINARY_DIR}/generated-include/${PROJECT_NAME}/ DESTINATION include/${PROJECT_NAME})