You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.8 KiB
43 lines
1.8 KiB
#
|
|
# Copyright 2020 Adobe. All rights reserved.
|
|
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software distributed under
|
|
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
# governing permissions and limitations under the License.
|
|
#
|
|
if(TARGET nlohmann::json)
|
|
return()
|
|
endif()
|
|
|
|
message(STATUS "Third-party: creating target 'nlohmann::json'")
|
|
|
|
# nlohmann_json is a big repo for a single header, so we just download the release archive
|
|
set(NLOHMANNJSON_VERSION "v3.10.2")
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
nlohmann_json
|
|
URL "https://github.com/nlohmann/json/releases/download/${NLOHMANNJSON_VERSION}/include.zip"
|
|
URL_HASH SHA256=61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca
|
|
)
|
|
FetchContent_MakeAvailable(nlohmann_json)
|
|
|
|
add_library(nlohmann_json INTERFACE)
|
|
add_library(nlohmann::json ALIAS nlohmann_json)
|
|
|
|
include(GNUInstallDirs)
|
|
target_include_directories(nlohmann_json INTERFACE
|
|
"$<BUILD_INTERFACE:${nlohmann_json_SOURCE_DIR}>/include"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
)
|
|
|
|
# Install rules
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME nlohmann_json)
|
|
install(DIRECTORY ${nlohmann_json_SOURCE_DIR}/include/nlohmann DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
install(TARGETS nlohmann_json EXPORT NlohmannJson_Targets)
|
|
install(EXPORT NlohmannJson_Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nlohmann_json NAMESPACE nlohmann_json::)
|
|
export(EXPORT NlohmannJson_Targets FILE "${CMAKE_CURRENT_BINARY_DIR}/NlohmannJsonTargets.cmake")
|
|
|