-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
55 lines (43 loc) · 1.6 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
cmake_minimum_required(VERSION 3.24)
project(rds2cpp
VERSION 1.1.0
DESCRIPTION "Standalone C++ library for reading RDS files"
LANGUAGES CXX)
add_library(rds2cpp INTERFACE)
add_library(ltla::rds2cpp ALIAS rds2cpp)
include(GNUInstallDirs)
target_include_directories(rds2cpp INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ltla_rds2cpp>)
target_compile_features(rds2cpp INTERFACE cxx_std_17)
option(RDS2CPP_FETCH_EXTERN "Automatically fetch rds2cpp's external dependencies." ON)
if(RDS2CPP_FETCH_EXTERN)
add_subdirectory(extern)
else()
find_package(ltla_byteme CONFIG REQUIRED)
endif()
target_link_libraries(rds2cpp INTERFACE ltla::byteme)
# Tests
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(RDS2CPP_TESTS "Build rds2cpp's tests." ON)
else()
option(RDS2CPP_TESTS "Build rds2cpp's tests." OFF)
endif()
if(RDS2CPP_TESTS)
add_subdirectory(examples)
endif()
# Install
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ltla_rds2cpp)
install(TARGETS rds2cpp
EXPORT rds2cppTargets)
install(EXPORT rds2cppTargets
FILE ltla_rds2cppTargets.cmake
NAMESPACE ltla::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_rds2cpp)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/ltla_rds2cppConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_rds2cpp)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ltla_rds2cppConfig.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_rds2cpp)