Przeglądaj źródła

gflags: patch to fix gflags-config.cmake (#1018)

* gflags: patch to fix gflags-config.cmake

* empty commit to trigger ci
Chen Yufei 3 lat temu
rodzic
commit
52aefef01f

+ 24 - 0
packages/g/gflags/patches/v2.2.2/fix-cmake.patch

@@ -0,0 +1,24 @@
+diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
+index a512c2a..2fe7844 100644
+--- a/cmake/config.cmake.in
++++ b/cmake/config.cmake.in
+@@ -36,8 +36,8 @@ set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
+ 
+ if (@PACKAGE_NAME@_FIND_COMPONENTS)
+   foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS)
+-    if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT})
+-      message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!")
++    if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT})
++      message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_PREFIX@_TARGET_PREFIX}${@PACKAGE_NAME@_FIND_COMPONENT}!")
+     endif ()
+   endforeach ()
+   list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT)
+@@ -78,7 +78,7 @@ if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS)
+     else ()
+       set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
+     endif ()
+-  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
++  elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
+     set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
+   else ()
+     set (@PACKAGE_PREFIX@_NOTHREADS TRUE)

+ 1 - 0
packages/g/gflags/xmake.lua

@@ -7,6 +7,7 @@ package("gflags")
     add_urls("https://github.com/gflags/gflags/archive/refs/tags/$(version).tar.gz",
              "https://github.com/gflags/gflags.git")
     add_versions("v2.2.2", "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf")
+    add_patches("v2.2.2", path.join(os.scriptdir(), "patches", "v2.2.2", "fix-cmake.patch"), "a2b9f99fe1421723aacd66e1a268efcb23c3dbf357776d4942c0bb25fc89d15c")
 
     add_configs("mt", {description = "Build the multi-threaded gflags library.", default = false, type = "boolean"})