diff options
author | Brad King <brad.king@kitware.com> | 2017-12-08 14:34:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-12-08 14:35:02 (GMT) |
commit | 158fb9755cffa427461addcaa6da8d18ec6246c6 (patch) | |
tree | ba6b565eea56729b85f335e71463be3f41d42a75 /Source | |
parent | bbac777698bf30be07a0edcc34ddc1a1e16b2dc5 (diff) | |
parent | 1bc603344725920dbc518c9e9545741edc0139d3 (diff) | |
download | CMake-158fb9755cffa427461addcaa6da8d18ec6246c6.zip CMake-158fb9755cffa427461addcaa6da8d18ec6246c6.tar.gz CMake-158fb9755cffa427461addcaa6da8d18ec6246c6.tar.bz2 |
Merge topic 'autogen-fix-library-deps'
1bc60334 Merge branch 'automoc-apple-framework' into autogen-fix-library-deps
a3f8371c Merge branch 'automoc-apple-framework' into autogen-fix-library-deps
bd49ae51 Autogen: Fix library dependency forwarding to _autogen target
e4ccc684 Autogen: Tests: Add test for MacOS frameworks
fcbd02fd Autogen: Fix for AUTOMOC on macOS frameworks in CMake 3.10
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1566
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index bd692a2..14743de 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -821,40 +821,39 @@ void cmQtAutoGeneratorInitializer::InitCustomTargets() this->Target->Target->AddPreBuildCommand(cc); } else { - // Convert file dependencies std::set to std::vector - std::vector<std::string> autogenDepends(autogenDependFiles.begin(), - autogenDependFiles.end()); - // Add link library target dependencies to the autogen target // dependencies - for (std::string const& config : this->ConfigsList) { - cmLinkImplementationLibraries const* libs = - this->Target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(this->Target, libTarget, config)) { - std::string util; - if (this->ConfigsList.size() > 1) { - util += "$<$<CONFIG:"; - util += config; - util += ">:"; - } - util += libTarget->GetName(); - if (this->ConfigsList.size() > 1) { - util += ">"; + { + // 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; + for (std::string const& config : this->ConfigsList) { + cmLinkImplementationLibraries const* libs = + this->Target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(this->Target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; } - autogenDepends.push_back(util); } } } + for (auto const& item : commonTargets) { + if (item.second == this->ConfigsList.size()) { + autogenDependTargets.insert(item.first->Target); + } + } } // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), /*byproducts=*/autogenProvides, autogenDepends, + this->DirWork.c_str(), /*byproducts=*/autogenProvides, + std::vector<std::string>(autogenDependFiles.begin(), + autogenDependFiles.end()), commandLines, false, autogenComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( |