summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2018-10-24 11:22:50 +0200
committerSebastian Holtermann <sebholt@xwmw.org>2018-11-03 12:14:40 +0100
commitb5e895b5d41dc688bf0acdec352cbccc178a7236 (patch)
treeec8b65fd661689d0c814f1e9583b12ce402e23fa
parent443c574a7cc39ea490fabd1392108e651806a3e6 (diff)
downloadcmake-b5e895b5d41dc688bf0acdec352cbccc178a7236.tar.gz
Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS support
This adds - the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes - the target property ``AUTOGEN_ORIGIN_DEPENDS`` which controls whether or not the origin target dependencies should be forwarded to the corresponding ``_autogen`` target. The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON`` which corresponds to the behavior that is in place since CMake 3.9. Closes: #18493
-rw-r--r--Modules/CMakeGenericSystem.cmake2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx11
-rw-r--r--Source/cmQtAutoGenInitializer.h1
-rw-r--r--Source/cmTarget.cxx1
4 files changed, 12 insertions, 3 deletions
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 02cb464501..ddfc7bd230 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -23,6 +23,8 @@ set(CMAKE_DL_LIBS "dl")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
+
+set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE")
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 7700767168..a213c844f0 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -322,6 +322,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
// Autogen target: Compute user defined dependencies
{
+ this->AutogenTarget.DependOrigin =
+ this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS");
+
std::string const deps =
this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
if (!deps.empty()) {
@@ -904,7 +907,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
// Add link library target dependencies to the autogen target
// dependencies
- {
+ if (this->AutogenTarget.DependOrigin) {
// add_dependencies/addUtility do not support generator expressions.
// We depend only on the libraries found in all configs therefore.
std::map<cmGeneratorTarget const*, std::size_t> commonTargets;
@@ -941,8 +944,10 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
new cmGeneratorTarget(autogenTarget, localGen));
// Forward origin utilities to autogen target
- for (BT<std::string> const& depName : this->Target->GetUtilities()) {
- autogenTarget->AddUtility(depName.Value, makefile);
+ if (this->AutogenTarget.DependOrigin) {
+ for (BT<std::string> const& depName : this->Target->GetUtilities()) {
+ autogenTarget->AddUtility(depName.Value, makefile);
+ }
}
// Add additional autogen target dependencies to autogen target
for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index ce00e00fea..1d3947b4b4 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -107,6 +107,7 @@ private:
std::string SettingsFile;
std::map<std::string, std::string> ConfigSettingsFile;
// Dependencies
+ bool DependOrigin = false;
std::set<std::string> DependFiles;
std::set<cmTarget*> DependTargets;
// Sources to process
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 987bdb3541..5d76a02788 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -239,6 +239,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("AUTOMOC", nullptr);
this->SetPropertyDefault("AUTOUIC", nullptr);
this->SetPropertyDefault("AUTORCC", nullptr);
+ this->SetPropertyDefault("AUTOGEN_ORIGIN_DEPENDS", nullptr);
this->SetPropertyDefault("AUTOGEN_PARALLEL", nullptr);
this->SetPropertyDefault("AUTOMOC_COMPILER_PREDEFINES", nullptr);
this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", nullptr);