summaryrefslogtreecommitdiffstats
path: root/externals
diff options
context:
space:
mode:
authorMarkus Wick <markus@selfnet.de>2020-05-09 11:32:52 +0200
committerMarkus Wick <markus@selfnet.de>2020-05-09 12:47:59 +0200
commit0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6 (patch)
tree2450c7c13c3829efe581586f7aef3263972bf571 /externals
parentFix libzip version check (diff)
downloadyuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar.gz
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar.bz2
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar.lz
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar.xz
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.tar.zst
yuzu-0e2a7ca91b23fa35fdd9e55879f4b7ba4f70d2b6.zip
Diffstat (limited to 'externals')
-rw-r--r--externals/find-modules/Findfmt.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/externals/find-modules/Findfmt.cmake b/externals/find-modules/Findfmt.cmake
index e0a04a344..8ba51cbea 100644
--- a/externals/find-modules/Findfmt.cmake
+++ b/externals/find-modules/Findfmt.cmake
@@ -13,12 +13,38 @@ find_library(fmt_LIBRARY
PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
)
+if(fmt_INCLUDE_DIR)
+ set(_fmt_version_file "${fmt_INCLUDE_DIR}/core.h")
+ if(NOT EXISTS "${_fmt_version_file}")
+ set(_fmt_version_file "${fmt_INCLUDE_DIR}/format.h")
+ endif()
+ if(EXISTS "${_fmt_version_file}")
+ # parse "#define FMT_VERSION 60200" to 6.2.0
+ file(STRINGS "${_fmt_version_file}" fmt_VERSION_LINE
+ REGEX "^#define[ \t]+FMT_VERSION[ \t]+[0-9]+$")
+ string(REGEX REPLACE "^#define[ \t]+FMT_VERSION[ \t]+([0-9]+)$"
+ "\\1" fmt_VERSION "${fmt_VERSION_LINE}")
+ foreach(ver "fmt_VERSION_PATCH" "fmt_VERSION_MINOR" "fmt_VERSION_MAJOR")
+ math(EXPR ${ver} "${fmt_VERSION} % 100")
+ math(EXPR fmt_VERSION "(${fmt_VERSION} - ${${ver}}) / 100")
+ endforeach()
+ set(fmt_VERSION
+ "${fmt_VERSION_MAJOR}.${fmt_VERSION_MINOR}.${fmt_VERSION_PATCH}")
+ endif()
+ unset(_fmt_version_file)
+ unset(fmt_VERSION_LINE)
+ unset(fmt_VERSION_MAJOR)
+ unset(fmt_VERSION_MINOR)
+ unset(fmt_VERSION_PATCH)
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(fmt
FOUND_VAR fmt_FOUND
REQUIRED_VARS
fmt_LIBRARY
fmt_INCLUDE_DIR
+ fmt_VERSION
VERSION_VAR fmt_VERSION
)