summaryrefslogtreecommitdiffstats
path: root/externals/find-modules
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2020-05-09 11:46:03 +0200
committerMarkus Wick <markus@selfnet.de>2020-05-09 12:47:59 +0200
commit290bc20e7985cbf75780d7f6033d64fa5e70cf45 (patch)
treedf851b2108fa83769fa0ae482a4409ae8e7b8450 /externals/find-modules
parentAdd version check for catch2 (diff)
downloadyuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.gz
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.bz2
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.lz
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.xz
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.zst
yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.zip
Diffstat (limited to 'externals/find-modules')
-rw-r--r--externals/find-modules/Findnlohmann_json.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/externals/find-modules/Findnlohmann_json.cmake b/externals/find-modules/Findnlohmann_json.cmake
index a3bf1d774..b0c5b3e4e 100644
--- a/externals/find-modules/Findnlohmann_json.cmake
+++ b/externals/find-modules/Findnlohmann_json.cmake
@@ -8,11 +8,25 @@ find_path(nlohmann_json_INCLUDE_DIR
PATH_SUFFIXES nlohmann
)
+if(nlohmann_json_INCLUDE_DIR)
+ file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
+ REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
+ set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
+ unset(_nlohmann_json_version_major)
+ unset(_nlohmann_json_version_minor)
+ unset(_nlohmann_json_version_patch)
+ unset(_nlohmann_json_version_lines)
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(nlohmann_json
FOUND_VAR nlohmann_json_FOUND
REQUIRED_VARS
nlohmann_json_INCLUDE_DIR
+ nlohmann_json_VERSION
VERSION_VAR nlohmann_json_VERSION
)