diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-07 09:21:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-07 14:04:05 (GMT) |
commit | fcbd02fd6ec56a6a4540e70082e899b45934dab8 (patch) | |
tree | 5182c1f6b24df57ab62eee73d33e826286bbe1ac | |
parent | 7746fdb2fe0177341aadeafec2ae73aa08ddfaf6 (diff) | |
download | CMake-fcbd02fd6ec56a6a4540e70082e899b45934dab8.zip CMake-fcbd02fd6ec56a6a4540e70082e899b45934dab8.tar.gz CMake-fcbd02fd6ec56a6a4540e70082e899b45934dab8.tar.bz2 |
Autogen: Fix for AUTOMOC on macOS frameworks in CMake 3.10
Revert the library target dependency forwarding to the `_autogen` target
to the 3.9.6 way, only now using `GetLinkImplementationLibraries`.
Fixes: #17278
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index c7550e6..b02d872 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -1046,40 +1046,39 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( 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 : configsList) { - cmLinkImplementationLibraries const* libs = - target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(target, libTarget, config)) { - std::string util; - if (configsList.size() > 1) { - util += "$<$<CONFIG:"; - util += config; - util += ">:"; - } - util += libTarget->GetName(); - if (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 : configsList) { + cmLinkImplementationLibraries const* libs = + target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; } - autogenDepends.push_back(util); } } } + for (auto const& item : commonTargets) { + if (item.second == configsList.size()) { + autogenDependTargets.insert(item.first->Target); + } + } } // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), - /*byproducts=*/autogenProvides, autogenDepends, commandLines, false, - autogenComment.c_str()); + /*byproducts=*/autogenProvides, + std::vector<std::string>(autogenDependFiles.begin(), + autogenDependFiles.end()), + commandLines, false, autogenComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autogenTarget, localGen)); |