-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (39 loc) · 1.52 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
cmake_minimum_required(VERSION 3.14)
project(millijson
VERSION 1.0.1
DESCRIPTION "Lightweight JSON library for C++"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
add_library(millijson INTERFACE)
add_library(ltla::millijson ALIAS millijson)
include(GNUInstallDirs)
target_include_directories(millijson INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ltla_millijson>")
# Building the test-related machinery, if we are compiling this library directly.
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(MILLIJSON_TESTS "Build millijson's test suite." ON)
else()
option(MILLIJSON_TESTS "Build millijson's test suite." OFF)
endif()
if(MILLIJSON_TESTS)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()
# Setting up the installation commands.
include(CMakePackageConfigHelpers)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ltla_millijson)
install(TARGETS millijson
EXPORT millijsonTargets)
install(EXPORT millijsonTargets
FILE ltla_millijsonTargets.cmake
NAMESPACE ltla::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_millijson)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/ltla_millijsonConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_millijson)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ltla_millijsonConfig.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ltla_millijson)