Refactor recursive target logic out of default_post into function
The qmake function prepareRecursiveTarget can now be used both by the existing logic in default_post, as well as future recursive targets that will be needed as part of the modularization of documentation builds. Change-Id: Ibc72c3e224cb57c9f1796de3b04fda9de663dbb4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
d060620e6c
commit
b9facbf345
@ -50,42 +50,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
|
||||
|
||||
# Let every project have a standard GNU `check' target
|
||||
!contains(QMAKE_EXTRA_TARGETS, check) {
|
||||
# `make check' should iterate through all subdirs
|
||||
# (except those with no_default_target or no_check_target)
|
||||
contains(TEMPLATE, subdirs) {
|
||||
for(subdir, SUBDIRS) {
|
||||
subdir_config=$$eval($${subdir}.CONFIG)
|
||||
!contains(subdir_config, no_check_target):!contains(subdir_config, no_default_target):check.recurse += $$subdir
|
||||
unset(subdir_config)
|
||||
}
|
||||
!isEmpty(check.recurse) {
|
||||
# setup the recurse target only when there is to recurse into
|
||||
check.CONFIG = recursive
|
||||
check.recurse_target = check
|
||||
}
|
||||
}
|
||||
# `make check' should imply building the project
|
||||
else {
|
||||
check.depends = first
|
||||
}
|
||||
contains(TEMPLATE, subdirs): \
|
||||
prepareRecursiveTarget(check)
|
||||
else: \
|
||||
check.depends = first # `make check' implies build
|
||||
QMAKE_EXTRA_TARGETS += check
|
||||
}
|
||||
|
||||
# Let every project have a 'docs' target
|
||||
!contains(QMAKE_EXTRA_TARGETS, docs) {
|
||||
contains(TEMPLATE, subdirs) {
|
||||
# `make docs' should iterate through all subdirs
|
||||
# (except those with no_default_target or no_docs_target)
|
||||
!contains(CONFIG, no_docs_target):for(subdir, SUBDIRS) {
|
||||
subdir_config = $$eval($${subdir}.CONFIG)
|
||||
!contains(subdir_config, no_docs_target):!contains(subdir_config, no_default_target):docs.recurse += $$subdir
|
||||
unset(subdir_config)
|
||||
}
|
||||
!isEmpty(docs.recurse) {
|
||||
# setup the recurse target only when there is something to recurse into
|
||||
docs.CONFIG = recursive
|
||||
docs.recurse_target = docs
|
||||
}
|
||||
prepareRecursiveTarget(docs)
|
||||
} else {
|
||||
# apps and libs only generate docs if QMAKE_DOCS is set
|
||||
!isEmpty(QMAKE_DOCS) {
|
||||
|
@ -267,3 +267,29 @@ defineTest(packagesExist) {
|
||||
return(true)
|
||||
}
|
||||
|
||||
# Prepares target that will iterate through all subdirs (except those
|
||||
# with no_default_target or no_{name_of_target}_target. The prepared
|
||||
# target must still be manually added to QMAKE_EXTRA_TARGETS.
|
||||
defineTest(prepareRecursiveTarget) {
|
||||
target = $$1
|
||||
no_$${target}_target: return()
|
||||
|
||||
for(subdir, SUBDIRS) {
|
||||
subdir_config = $$eval($${subdir}.CONFIG)
|
||||
contains(subdir_config, no_default_target): next()
|
||||
contains(subdir_config, no_$${target}_target): next()
|
||||
|
||||
$${target}.recurse += $$subdir
|
||||
}
|
||||
|
||||
# Set up the recurse target only when there
|
||||
# is something to recurse into.
|
||||
isEmpty($${target}.recurse): return()
|
||||
|
||||
$${target}.CONFIG = recursive
|
||||
$${target}.recurse_target = $${target}
|
||||
|
||||
export($${target}.recurse)
|
||||
export($${target}.CONFIG)
|
||||
export($${target}.recurse_target)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user