summaryrefslogtreecommitdiff
path: root/cmake/Findnlohmann_json.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Findnlohmann_json.cmake')
-rw-r--r--cmake/Findnlohmann_json.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/cmake/Findnlohmann_json.cmake b/cmake/Findnlohmann_json.cmake
new file mode 100644
index 0000000..9b40b14
--- /dev/null
+++ b/cmake/Findnlohmann_json.cmake
@@ -0,0 +1,28 @@
+set(NLOHMANN_JSON_LIBRARY_NAME nlohmann_json)
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_NLOHMANN_JSON QUIET ${NLOHMANN_JSON_LIBRARY_NAME})
+ set(NLOHMANN_JSON_DEFINITIONS ${PC_NLOHMANN_JSON_CFLAGS_OTHER})
+endif()
+
+set(NLOHMANN_JSON_INCLUDE_HINTS ${PC_NLOHMANN_JSON_INCLUDEDIR} ${PC_NLOHMANN_JSON_INCLUDE_DIRS})
+
+set(NLOHMANN_JSON_ROOT_DIR "$ENV{NLOHMANN_JSON_ROOT_DIR}")
+
+find_path(NLOHMANN_JSON_INCLUDE_DIR
+ NAMES nlohmann/json.hpp
+ PATHS $ENV{PROGRAMFILES}/include/
+ ${NLOHMANN_JSON_ROOT_DIR}/
+ ${NLOHMANN_JSON_ROOT_DIR}/include/
+ HINTS ${NLOHMANN_JSON_INCLUDE_HINTS})
+
+set(NLOHMANN_JSON_INCLUDE_DIRS ${NLOHMANN_JSON_INCLUDE_DIR})
+set(NLOHMANN_JSON_LIBRARIES "")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(nlohmann_json
+ FOUND_VAR NLOHMANN_JSON_FOUND
+ REQUIRED_VARS
+ NLOHMANN_JSON_INCLUDE_DIR
+ VERSION_VAR NLOHMANN_JSON_VERSION)