summaryrefslogtreecommitdiff
path: root/externals/find-modules/Findnlohmann_json.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'externals/find-modules/Findnlohmann_json.cmake')
-rw-r--r--externals/find-modules/Findnlohmann_json.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/externals/find-modules/Findnlohmann_json.cmake b/externals/find-modules/Findnlohmann_json.cmake
new file mode 100644
index 000000000..a3bf1d774
--- /dev/null
+++ b/externals/find-modules/Findnlohmann_json.cmake
@@ -0,0 +1,35 @@
1
2find_package(PkgConfig QUIET)
3pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
4
5find_path(nlohmann_json_INCLUDE_DIR
6 NAMES json.hpp
7 PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
8 PATH_SUFFIXES nlohmann
9)
10
11include(FindPackageHandleStandardArgs)
12find_package_handle_standard_args(nlohmann_json
13 FOUND_VAR nlohmann_json_FOUND
14 REQUIRED_VARS
15 nlohmann_json_INCLUDE_DIR
16 VERSION_VAR nlohmann_json_VERSION
17)
18
19if(nlohmann_json_FOUND)
20 set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
21 set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
22endif()
23
24if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
25 add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
26 set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
27 IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
28 INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
29 INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
30 )
31endif()
32
33mark_as_advanced(
34 nlohmann_json_INCLUDE_DIR
35)