diff options
| author | 2020-05-09 11:42:56 +0200 | |
|---|---|---|
| committer | 2020-05-09 12:47:59 +0200 | |
| commit | c96a8867f01ed2c454196629f032ae0a837c1cd3 (patch) | |
| tree | 675cd25219ead534909ab2341ba816064a417a65 | |
| parent | Add version check to Findfmt (diff) | |
| download | yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.gz yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.xz yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.zip | |
Add version check for catch2
Diffstat (limited to '')
| -rw-r--r-- | externals/find-modules/FindCatch2.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake index a83c668bf..ce1d40bae 100644 --- a/externals/find-modules/FindCatch2.cmake +++ b/externals/find-modules/FindCatch2.cmake | |||
| @@ -8,11 +8,25 @@ find_path(Catch2_INCLUDE_DIR | |||
| 8 | PATH_SUFFIXES catch2 | 8 | PATH_SUFFIXES catch2 |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| 11 | if(Catch2_INCLUDE_DIR) | ||
| 12 | file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines | ||
| 13 | REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)") | ||
| 14 | string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}") | ||
| 15 | string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}") | ||
| 16 | string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}") | ||
| 17 | set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}") | ||
| 18 | unset(_Catch2_version_major) | ||
| 19 | unset(_Catch2_version_minor) | ||
| 20 | unset(_Catch2_version_patch) | ||
| 21 | unset(_Catch2_version_lines) | ||
| 22 | endif() | ||
| 23 | |||
| 11 | include(FindPackageHandleStandardArgs) | 24 | include(FindPackageHandleStandardArgs) |
| 12 | find_package_handle_standard_args(Catch2 | 25 | find_package_handle_standard_args(Catch2 |
| 13 | FOUND_VAR Catch2_FOUND | 26 | FOUND_VAR Catch2_FOUND |
| 14 | REQUIRED_VARS | 27 | REQUIRED_VARS |
| 15 | Catch2_INCLUDE_DIR | 28 | Catch2_INCLUDE_DIR |
| 29 | Catch2_VERSION | ||
| 16 | VERSION_VAR Catch2_VERSION | 30 | VERSION_VAR Catch2_VERSION |
| 17 | ) | 31 | ) |
| 18 | 32 | ||