mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 16:22:47 +01:00
Add version check for catch2
This commit is contained in:
parent
0e2a7ca91b
commit
c96a8867f0
1 changed files with 14 additions and 0 deletions
14
externals/find-modules/FindCatch2.cmake
vendored
14
externals/find-modules/FindCatch2.cmake
vendored
|
@ -8,11 +8,25 @@ find_path(Catch2_INCLUDE_DIR
|
||||||
PATH_SUFFIXES catch2
|
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)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(Catch2
|
find_package_handle_standard_args(Catch2
|
||||||
FOUND_VAR Catch2_FOUND
|
FOUND_VAR Catch2_FOUND
|
||||||
REQUIRED_VARS
|
REQUIRED_VARS
|
||||||
Catch2_INCLUDE_DIR
|
Catch2_INCLUDE_DIR
|
||||||
|
Catch2_VERSION
|
||||||
VERSION_VAR Catch2_VERSION
|
VERSION_VAR Catch2_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue