diff options
| author | 2020-05-09 11:46:03 +0200 | |
|---|---|---|
| committer | 2020-05-09 12:47:59 +0200 | |
| commit | 290bc20e7985cbf75780d7f6033d64fa5e70cf45 (patch) | |
| tree | df851b2108fa83769fa0ae482a4409ae8e7b8450 | |
| parent | Add version check for catch2 (diff) | |
| download | yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.gz yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.tar.xz yuzu-290bc20e7985cbf75780d7f6033d64fa5e70cf45.zip | |
Add version check to Findnlohmann_json.cmake
| -rw-r--r-- | externals/find-modules/Findnlohmann_json.cmake | 14 |
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 | |||
| 8 | PATH_SUFFIXES nlohmann | 8 | PATH_SUFFIXES nlohmann |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| 11 | if(nlohmann_json_INCLUDE_DIR) | ||
| 12 | file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines | ||
| 13 | REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)") | ||
| 14 | string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}") | ||
| 15 | string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}") | ||
| 16 | string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}") | ||
| 17 | set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}") | ||
| 18 | unset(_nlohmann_json_version_major) | ||
| 19 | unset(_nlohmann_json_version_minor) | ||
| 20 | unset(_nlohmann_json_version_patch) | ||
| 21 | unset(_nlohmann_json_version_lines) | ||
| 22 | endif() | ||
| 23 | |||
| 11 | include(FindPackageHandleStandardArgs) | 24 | include(FindPackageHandleStandardArgs) |
| 12 | find_package_handle_standard_args(nlohmann_json | 25 | find_package_handle_standard_args(nlohmann_json |
| 13 | FOUND_VAR nlohmann_json_FOUND | 26 | FOUND_VAR nlohmann_json_FOUND |
| 14 | REQUIRED_VARS | 27 | REQUIRED_VARS |
| 15 | nlohmann_json_INCLUDE_DIR | 28 | nlohmann_json_INCLUDE_DIR |
| 29 | nlohmann_json_VERSION | ||
| 16 | VERSION_VAR nlohmann_json_VERSION | 30 | VERSION_VAR nlohmann_json_VERSION |
| 17 | ) | 31 | ) |
| 18 | 32 | ||