diff options
author | Adrian Grigo <agrigo2001@yahoo.com.au> | 2020-12-08 14:19:22 +1100 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2020-12-12 18:58:23 +0100 |
commit | 814b6b0d056d858c629720ca1a97400688d2542f (patch) | |
tree | 3543eb3f549133214ae7388e9da1cafa85f23b48 /dev-util/cmake | |
parent | dev-util/cmake: Fix spurious include target (diff) | |
download | gentoo-814b6b0d056d858c629720ca1a97400688d2542f.tar.gz gentoo-814b6b0d056d858c629720ca1a97400688d2542f.tar.bz2 gentoo-814b6b0d056d858c629720ca1a97400688d2542f.zip |
dev-util/cmake: Backport FPHSA fix
Changes to Find Package Handle Standard Args in 3.19.0 result in
an error when compiling openvdb-7.1.0.
This is a known problem in cmake and the fix has been merged into
3.19.2 upstream.
See https://gitlab.kitware.com/cmake/cmake/-/issues/21505
To produce the bug:
emerge dev-util/cmake-3.19.0 or 3.19.1 (the bug not exist in <= 3.18)
emerge media-gfx/openvdb-7.1.0-r1
Compilation fails with
find_package_check_version(): Cannot be used outside a 'Find Module'
To fix the bug:
Apply the patch provided in this bug fix to cmake, then repeat the
above steps and compilation of openvdb succeeds.
The patch ensures that the CMAKE_FPHSA_PACKAGE_NAME package is made
available outside find_package.
Thanks to Dennis Schridde for finding the upstream fix, produced by
Marc Chevrier.
* committer-comment: use Gentoo bug ref; git format-patch 14ecf9c2f
Signed-off-by: Adrian Grigo <agrigo2001@yahoo.com.au>
Closes: https://bugs.gentoo.org/755743
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Closes: https://github.com/gentoo/gentoo/pull/18560
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'dev-util/cmake')
-rw-r--r-- | dev-util/cmake/cmake-3.19.1-r1.ebuild | 1 | ||||
-rw-r--r-- | dev-util/cmake/files/cmake-3.19.1-use-FPHSA-outside-find_package.patch | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/dev-util/cmake/cmake-3.19.1-r1.ebuild b/dev-util/cmake/cmake-3.19.1-r1.ebuild index 97f173f95a83..2726694149e4 100644 --- a/dev-util/cmake/cmake-3.19.1-r1.ebuild +++ b/dev-util/cmake/cmake-3.19.1-r1.ebuild @@ -70,6 +70,7 @@ PATCHES=( # upstream fixes (can usually be removed with a version bump) "${FILESDIR}"/${P}-fix-spurious-include-target.patch # bug 759271 + "${FILESDIR}"/${P}-use-FPHSA-outside-find_package.patch # bug 755743 ) cmake_src_bootstrap() { diff --git a/dev-util/cmake/files/cmake-3.19.1-use-FPHSA-outside-find_package.patch b/dev-util/cmake/files/cmake-3.19.1-use-FPHSA-outside-find_package.patch new file mode 100644 index 000000000000..8cde769ce8f8 --- /dev/null +++ b/dev-util/cmake/files/cmake-3.19.1-use-FPHSA-outside-find_package.patch @@ -0,0 +1,40 @@ +From 14ecf9c2f6edfae4033d9311f79d79d0d07fc1cf Mon Sep 17 00:00:00 2001 +From: Marc Chevrier <marc.chevrier@gmail.com> +Date: Wed, 25 Nov 2020 16:36:12 +0100 +Subject: [PATCH] FPHSA: ensure it can be used outside 'find_package' + +Fixes: #21505 +--- + Modules/FindPackageHandleStandardArgs.cmake | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake +index 7af017136d..7e172779e4 100644 +--- a/Modules/FindPackageHandleStandardArgs.cmake ++++ b/Modules/FindPackageHandleStandardArgs.cmake +@@ -275,8 +275,10 @@ function(FIND_PACKAGE_CHECK_VERSION version result) + unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE) + endif() + +- if (CMAKE_FIND_PACKAGE_NAME) +- set (package ${CMAKE_FIND_PACKAGE_NAME}) ++ if (_CMAKE_FPHSA_PACKAGE_NAME) ++ set (package "${_CMAKE_FPHSA_PACKAGE_NAME}") ++ elseif (CMAKE_FIND_PACKAGE_NAME) ++ set (package "${CMAKE_FIND_PACKAGE_NAME}") + else() + message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'") + endif() +@@ -436,6 +438,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + "will be used.") + endif() + ++ # to propagate package name to FIND_PACKAGE_CHECK_VERSION ++ set(_CMAKE_FPHSA_PACKAGE_NAME "${_NAME}") ++ + # now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") +-- +GitLab + |