Skip to content

Commit

Permalink
cmake.eclass: cmake_punt_find_package: Support <filename> being a dir…
Browse files Browse the repository at this point in the history
…ectory

Signed-off-by: Andreas Sturmlechner <[email protected]>
  • Loading branch information
a17r committed Nov 27, 2024
1 parent eafb392 commit c80fc7b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions eclass/cmake.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ cmake_comment_add_subdirectory() {
# @FUNCTION: cmake_punt_find_package
# @USAGE: [-f <filename>] <pkg> [<components>...]
# @DESCRIPTION:
# Default value for <filename> is CMakeLists.txt if not set.
# Default value for <filename> is CMakeLists.txt if not set. If given a
# directory instead, will try to modify a CMakeLists.txt below, if exists.
# In <filename> below current directory, remove a find_package(<pkg>) call.
# If given one or more <components>, remove those from COMPONENTS instead.
cmake_punt_find_package() {
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit c80fc7b

Please sign in to comment.