diff options
author | Craig Scott <craig.scott@crascit.com> | 2017-08-02 21:44:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-08-02 21:44:59 (GMT) |
commit | 54bc20dd8c4cc042621f21896e32a9b7e25aa892 (patch) | |
tree | 2e26c830c1b82a6d7d9145a21082002b729e538e /Source | |
parent | 901456d76e769af3868d2163d9345ca53af16353 (diff) | |
parent | a3a62fcc3cb5bc111764f5721694513d206c1cb9 (diff) | |
download | CMake-54bc20dd8c4cc042621f21896e32a9b7e25aa892.zip CMake-54bc20dd8c4cc042621f21896e32a9b7e25aa892.tar.gz CMake-54bc20dd8c4cc042621f21896e32a9b7e25aa892.tar.bz2 |
Merge topic 'autogen-depends'
a3a62fcc Autogen: Add AUTOMOC test for target dependencies forwarding
7fa9c550 Autogen: Forward target dependencies to *_autogen target
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1087
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 92fa1bd..108241a 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -745,7 +745,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( const std::string qtMajorVersion = GetQtMajorVersion(target); const std::string rccCommand = RccGetExecutable(target, qtMajorVersion); const std::vector<std::string> suffixes = GetConfigurationSuffixes(makefile); - std::vector<std::string> autogenDepends; + std::set<std::string> autogenDependsSet; std::vector<std::string> autogenProvides; // Remove build directories on cleanup @@ -837,7 +837,20 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // Initialize autogen target dependencies if (const char* deps = target->GetProperty("AUTOGEN_TARGET_DEPENDS")) { - cmSystemTools::ExpandListArgument(deps, autogenDepends); + std::vector<std::string> extraDepends; + cmSystemTools::ExpandListArgument(deps, extraDepends); + autogenDependsSet.insert(extraDepends.begin(), extraDepends.end()); + } + // Add other target dependencies autogen dependencies + { + const std::set<std::string>& utils = target->Target->GetUtilities(); + for (std::set<std::string>::const_iterator it = utils.begin(); + it != utils.end(); ++it) { + const std::string& targetName = *it; + if (makefile->FindTargetToUse(targetName) != CM_NULLPTR) { + autogenDependsSet.insert(targetName); + } + } } // Add link library targets to the autogen dependencies { @@ -847,7 +860,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( it != libVec.end(); ++it) { const std::string& libName = it->first; if (makefile->FindTargetToUse(libName) != CM_NULLPTR) { - autogenDepends.push_back(libName); + autogenDependsSet.insert(libName); } } } @@ -871,7 +884,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( if (PropertyEnabled(sf, "GENERATED")) { if ((mocEnabled && !PropertyEnabled(sf, "SKIP_AUTOMOC")) || (uicEnabled && !PropertyEnabled(sf, "SKIP_AUTOUIC"))) { - autogenDepends.push_back( + autogenDependsSet.insert( cmsys::SystemTools::GetRealPath(sf->GetFullPath())); #if defined(_WIN32) && !defined(__CYGWIN__) // Cannot use PRE_BUILD with generated files @@ -916,17 +929,22 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( if (PropertyEnabled(sf, "GENERATED")) { // Add generated qrc file to the dependencies - autogenDepends.push_back(absFile); + autogenDependsSet.insert(absFile); } else { // Run cmake again when .qrc file changes makefile->AddCMakeDependFile(absFile); - // Add the qrc input files to the dependencies - std::string error; - if (!cmQtAutoGeneratorCommon::RccListInputs( - qtMajorVersion, rccCommand, absFile, autogenDepends, - &error)) { - cmSystemTools::Error(error.c_str()); + { + std::string error; + std::vector<std::string> extraDepends; + if (cmQtAutoGeneratorCommon::RccListInputs( + qtMajorVersion, rccCommand, absFile, extraDepends, + &error)) { + autogenDependsSet.insert(extraDepends.begin(), + extraDepends.end()); + } else { + cmSystemTools::Error(error.c_str()); + } } } #if defined(_WIN32) && !defined(__CYGWIN__) @@ -940,10 +958,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( } } + // Convert std::set to std::vector + const std::vector<std::string> autogenDepends(autogenDependsSet.begin(), + autogenDependsSet.end()); #if defined(_WIN32) && !defined(__CYGWIN__) if (usePRE_BUILD) { // If the autogen target depends on an other target don't use PRE_BUILD - for (std::vector<std::string>::iterator it = autogenDepends.begin(); + for (std::vector<std::string>::const_iterator it = autogenDepends.begin(); it != autogenDepends.end(); ++it) { if (makefile->FindTargetToUse(*it) != CM_NULLPTR) { usePRE_BUILD = false; |