-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
66 lines (50 loc) · 2.2 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
cmake_minimum_required(VERSION 3.5)
option(HIPONY_ENUMERATE_AGGREGATES_ENABLED "Enable aggregate support" OFF)
project(enumerate LANGUAGES CXX VERSION 1.0.0)
include(CTest)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
add_library(enumerate INTERFACE)
add_library(hipony::enumerate ALIAS enumerate)
target_compile_features(enumerate INTERFACE cxx_std_11)
target_include_directories(
enumerate
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
if(HIPONY_ENUMERATE_AGGREGATES_ENABLED)
# We use QUIET for Conan integration, since there is no official CMake target for PFR yet
# but we encourage users to provide their own integration by other means
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
find_package(pfr QUIET)
if(pfr_FOUND)
target_link_libraries(enumerate INTERFACE pfr::pfr)
endif()
target_compile_definitions(enumerate INTERFACE HIPONY_ENUMERATE_AGGREGATES_ENABLED)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/hipony-enumerate-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/hipony-enumerate-config.cmake"
INSTALL_DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/hipony-enumerate")
set(ENUMERATE_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
set(CMAKE_SIZEOF_VOID_P "")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/hipony-enumerate-config-version.cmake"
COMPATIBILITY SameMajorVersion)
set(CMAKE_SIZEOF_VOID_P ${ENUMERATE_CMAKE_SIZEOF_VOID_P})
install(TARGETS enumerate
EXPORT hipony-enumerate
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(EXPORT hipony-enumerate
NAMESPACE hipony::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hipony-enumerate")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hipony-enumerate-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/hipony-enumerate-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/hipony-enumerate")
install(DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
export(EXPORT hipony-enumerate
NAMESPACE hipony::
FILE "${CMAKE_CURRENT_BINARY_DIR}/hipony-enumerate-targets.cmake")