Skip to content

Commit eafb392

Browse files
committed
ecm.eclass: Use cmake_punt_find_package from cmake.eclass
Signed-off-by: Andreas Sturmlechner <[email protected]>
1 parent 7281662 commit eafb392

File tree

1 file changed

+3
-69
lines changed

1 file changed

+3
-69
lines changed

eclass/ecm.eclass

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -367,44 +367,13 @@ _ecm_strip_handbook_translations() {
367367
done
368368
}
369369

370-
# @FUNCTION: _ecm_punt_kfqt_module
371-
# @USAGE: <prefix> <dependency>
372-
# @INTERNAL
373-
# @DESCRIPTION:
374-
# Removes a specified dependency from a find_package call with multiple
375-
# components.
376-
_ecm_punt_kfqt_module() {
377-
local prefix=${1}
378-
local dep=${2}
379-
380-
[[ ! -e "CMakeLists.txt" ]] && return
381-
382-
# FIXME: dep=WebKit will result in 'Widgets' over 'WebKitWidgets' (no regression)
383-
pcre2grep -Mni "(?s)find_package\s*\(\s*${prefix}(\d+|\\$\{\w*\})[^)]*?${dep}.*?\)" \
384-
CMakeLists.txt > "${T}/bogus${dep}"
385-
386-
# pcre2grep returns non-zero on no matches/error
387-
[[ $? -ne 0 ]] && return
388-
389-
local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
390-
local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
391-
local last=$(( length + first - 1))
392-
393-
sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
394-
395-
if [[ ${length} -eq 1 ]] ; then
396-
sed -e "/find_package\s*(\s*${prefix}\([0-9]\|\${[A-Z0-9_]*}\)\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# '${dep}' removed by ecm.eclass - /" \
397-
-i CMakeLists.txt || die
398-
fi
399-
}
400-
401370
# @FUNCTION: ecm_punt_kf_module
402371
# @USAGE: <modulename>
403372
# @DESCRIPTION:
404373
# Removes a Frameworks (KF - matching any single-digit version)
405374
# module from a find_package call with multiple components.
406375
ecm_punt_kf_module() {
407-
_ecm_punt_kfqt_module kf ${1}
376+
cmake_punt_find_package kf ${1}
408377
}
409378

410379
# @FUNCTION: ecm_punt_qt_module
@@ -413,7 +382,7 @@ ecm_punt_kf_module() {
413382
# Removes a Qt (matching any single-digit version) module from a
414383
# find_package call with multiple components.
415384
ecm_punt_qt_module() {
416-
_ecm_punt_kfqt_module qt ${1}
385+
cmake_punt_find_package qt ${1}
417386
}
418387

419388
# @FUNCTION: ecm_punt_bogus_dep
@@ -422,42 +391,7 @@ ecm_punt_qt_module() {
422391
# Removes a specified dependency from a find_package call, optionally
423392
# supports prefix for find_package with multiple components.
424393
ecm_punt_bogus_dep() {
425-
426-
if [[ "$#" == 2 ]] ; then
427-
local prefix=${1}
428-
local dep=${2}
429-
elif [[ "$#" == 1 ]] ; then
430-
local dep=${1}
431-
else
432-
die "${FUNCNAME[0]} must be passed either one or two arguments"
433-
fi
434-
435-
if [[ ! -e "CMakeLists.txt" ]]; then
436-
return
437-
fi
438-
439-
if [[ -z ${prefix} ]]; then
440-
sed -e "/find_package\s*(\s*${dep}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" \
441-
-i CMakeLists.txt || die
442-
return
443-
else
444-
pcre2grep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
445-
fi
446-
447-
# pcre2grep returns non-zero on no matches/error
448-
if [[ $? -ne 0 ]] ; then
449-
return
450-
fi
451-
452-
local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
453-
local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
454-
local last=$(( length + first - 1))
455-
456-
sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
457-
458-
if [[ ${length} -eq 1 ]] ; then
459-
sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" -i CMakeLists.txt || die
460-
fi
394+
cmake_punt_find_package $@
461395
}
462396

463397
# @FUNCTION: _ecm_punt_kdoctools_install

0 commit comments

Comments
 (0)