2022-05-03 18:53:24 +02:00
|
|
|
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
2020-09-29 13:47:50 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
## PROJECT
|
|
|
|
## name and version
|
|
|
|
##
|
2021-12-11 23:32:21 +01:00
|
|
|
project(nlohmann_json VERSION 3.10.4 LANGUAGES CXX)
|
2020-09-29 13:47:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
## OPTIONS
|
|
|
|
##
|
|
|
|
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." ON)
|
|
|
|
|
|
|
|
##
|
|
|
|
## CONFIGURATION
|
|
|
|
##
|
|
|
|
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
|
|
|
|
|
|
|
|
if (JSON_MultipleHeaders)
|
|
|
|
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/")
|
|
|
|
message(STATUS "Using the multi-header code from ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}")
|
|
|
|
else()
|
|
|
|
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/single_include/")
|
|
|
|
message(STATUS "Using the single-header code from ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
##
|
|
|
|
## TARGET
|
|
|
|
## create target and add include path
|
|
|
|
##
|
|
|
|
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
|
|
|
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
|
|
|
|
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
|
|
|
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for)
|
|
|
|
else()
|
|
|
|
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(${NLOHMANN_JSON_TARGET_NAME} INTERFACE ${NLOHMANN_JSON_INCLUDE_BUILD_DIR})
|
|
|
|
|