Compare commits
1 Commits
main
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20138c186c |
@ -10,19 +10,12 @@ option(BUILD_EXAMPLES "Build examples" ON)
|
|||||||
if(NOT TARGET json-hpp)
|
if(NOT TARGET json-hpp)
|
||||||
set(NLOHMANN_JSON_DIR "" CACHE STRING "path to json.hpp")
|
set(NLOHMANN_JSON_DIR "" CACHE STRING "path to json.hpp")
|
||||||
|
|
||||||
# find nlohmann's json.hpp
|
if(NOT EXISTS ${NLOHMANN_JSON_DIR}/nlohmann/json.hpp)
|
||||||
find_path(JSON_HPP nlohmann/json.hpp
|
|
||||||
PATHS
|
|
||||||
${NLOHMANN_JSON_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}/${NLOHMANN_JSON_DIR}) # in case it is a relative path
|
|
||||||
|
|
||||||
# get the full, real path
|
|
||||||
get_filename_component(NLOHMANN_JSON_REALPATH ${JSON_HPP} REALPATH)
|
|
||||||
|
|
||||||
if(NOT EXISTS ${NLOHMANN_JSON_REALPATH}/nlohmann/json.hpp)
|
|
||||||
message(FATAL_ERROR "please set NLOHMANN_JSON_DIR to a path in which NLohmann's json.hpp can be found. Looking for nlohmann/json.hpp in '${NLOHMANN_JSON_REALPATH}")
|
message(FATAL_ERROR "please set NLOHMANN_JSON_DIR to a path in which NLohmann's json.hpp can be found. Looking for nlohmann/json.hpp in '${NLOHMANN_JSON_REALPATH}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_filename_component(NLOHMANN_JSON_REALPATH ${NLOHMANN_JSON_DIR} REALPATH)
|
||||||
|
|
||||||
# create an interface-library for simple cmake-linking
|
# create an interface-library for simple cmake-linking
|
||||||
add_library(json-hpp INTERFACE)
|
add_library(json-hpp INTERFACE)
|
||||||
target_include_directories(json-hpp
|
target_include_directories(json-hpp
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user