summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2020-05-09 11:42:56 +0200
committerMarkus Wick <markus@selfnet.de>2020-05-09 12:47:59 +0200
commitc96a8867f01ed2c454196629f032ae0a837c1cd3 (patch)
tree675cd25219ead534909ab2341ba816064a417a65
parentAdd version check to Findfmt (diff)
downloadyuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.gz
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.bz2
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.lz
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.xz
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.tar.zst
yuzu-c96a8867f01ed2c454196629f032ae0a837c1cd3.zip
-rw-r--r--externals/find-modules/FindCatch2.cmake14
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
PATH_SUFFIXES catch2
)
+if(Catch2_INCLUDE_DIR)
+ file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
+ REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
+ string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
+ string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
+ string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
+ set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
+ unset(_Catch2_version_major)
+ unset(_Catch2_version_minor)
+ unset(_Catch2_version_patch)
+ unset(_Catch2_version_lines)
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Catch2
FOUND_VAR Catch2_FOUND
REQUIRED_VARS
Catch2_INCLUDE_DIR
+ Catch2_VERSION
VERSION_VAR Catch2_VERSION
)