From c80fc7b54be5254df554b45300254604dd84c02b Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Wed, 27 Nov 2024 23:01:25 +0100 Subject: [PATCH] cmake.eclass: cmake_punt_find_package: Support being a directory Signed-off-by: Andreas Sturmlechner --- eclass/cmake.eclass | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index a26f6fe99df..a096e1ba7c2 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -185,7 +185,8 @@ cmake_comment_add_subdirectory() { # @FUNCTION: cmake_punt_find_package # @USAGE: [-f ] [...] # @DESCRIPTION: -# Default value for is CMakeLists.txt if not set. +# Default value for is CMakeLists.txt if not set. If given a +# directory instead, will try to modify a CMakeLists.txt below, if exists. # In below current directory, remove a find_package() call. # If given one or more , remove those from COMPONENTS instead. cmake_punt_find_package() { @@ -206,7 +207,11 @@ cmake_punt_find_package() { shift ;; esac - if [[ ! -e "${filename}" ]]; then + if [[ -d ${filename} ]]; then + filename+="/CMakeLists.txt" + einfo "modifying ${filename}!" + fi + if [[ ! -e ${filename} ]]; then die "${FUNCNAME[0]}: called on non-existing ${filename}" return fi @@ -221,7 +226,7 @@ cmake_punt_find_package() { # pcre2grep returns non-zero on no matches/error if [[ $? -ne 0 ]]; then - eqawarn "QA Notice: ${FUNCNAME[0]}(${pkg}, ${cmpnt}) called, but no matches found!" + eqawarn "QA Notice: ${FUNCNAME}(${pkg}, ${cmpnt}) called, but no matches found!" continue fi