commit:     6f2b78164fd1dd7578a70509ef7b08f79d2c1ace
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 25 14:04:14 2016 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Mon Jan 25 14:07:07 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f2b7816

cmake-utils.eclass: require two arguments for cmake-utils_use_find_package in 
EAPI 6 and later

This will allow us to remove the capitalisation variants code later.

 eclass/cmake-utils.eclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 26c5201..8ed1ce9 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -295,14 +295,20 @@ cmake-utils_use_with() { _cmake_use_me_now WITH_ "$@" ; }
 cmake-utils_use_enable() { _cmake_use_me_now ENABLE_ "$@" ; }
 
 # @FUNCTION: cmake-utils_use_find_package
-# @USAGE: <USE flag> [flag name]
+# @USAGE: <USE flag> <package name>
 # @DESCRIPTION:
 # Based on use_enable. See ebuild(5).
 #
 # `cmake-utils_use_find_package foo LibFoo` echoes 
-DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=OFF
 # if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is 
disabled.
 # This can be used to make find_package optional.
-cmake-utils_use_find_package() { _cmake_use_me_now_inverted 
CMAKE_DISABLE_FIND_PACKAGE_ "$@" ; }
+cmake-utils_use_find_package() {
+       if ! has "${EAPI:-0}" 2 3 4 5 && [[ "$#" != 2 ]] ; then
+               die "Usage: cmake-utils_use_find_package <USE flag> <package 
name>"
+       fi
+
+       _cmake_use_me_now_inverted CMAKE_DISABLE_FIND_PACKAGE_ "$@" ;
+}
 
 # @FUNCTION: cmake-utils_use_disable
 # @USAGE: <USE flag> [flag name]

Reply via email to