From ca697bfc264e4058de26942590aeaca25182ce15 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Apr 2017 11:22:56 -0400 Subject: cmGeneratorTarget: Drop obj libs from GetConfigCommonSourceFiles Call sites such as those in the VS global generator that are used only to reject per-config sources will now allow per-config object library objects. The corresponding generators have already been taught to deal with per-config object library files. Remaining call sites do not need object library files anyway. This will later allow `$` generator expressions to evaluate to values that vary by configuration (e.g. because each configuration has its own object files). --- Source/cmGeneratorTarget.cxx | 17 +++++++++++++++-- Source/cmGeneratorTarget.h | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4c8a2c6353..35b26032ad 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -949,6 +949,19 @@ void cmGeneratorTarget::GetSourceFiles(std::vector& files, } } +void cmGeneratorTarget::GetSourceFilesWithoutObjectLibraries( + std::vector& files, const std::string& config) const +{ + KindedSources const& kinded = this->GetKindedSources(config); + files.reserve(kinded.Sources.size()); + for (std::vector::const_iterator si = kinded.Sources.begin(); + si != kinded.Sources.end(); ++si) { + if (si->Source->GetObjectLibrary().empty()) { + files.push_back(si->Source); + } + } +} + cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources( std::string const& config) const { @@ -4937,11 +4950,11 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector::const_iterator it = configs.begin(); const std::string& firstConfig = *it; - this->GetSourceFiles(files, firstConfig); + this->GetSourceFilesWithoutObjectLibraries(files, firstConfig); for (; it != configs.end(); ++it) { std::vector configFiles; - this->GetSourceFiles(configFiles, *it); + this->GetSourceFilesWithoutObjectLibraries(configFiles, *it); if (configFiles != files) { std::string firstConfigFiles; const char* sep = ""; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index dd25caddfd..d4f48fe909 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -70,6 +70,8 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files, const std::string& config) const; + void GetSourceFilesWithoutObjectLibraries(std::vector& files, + const std::string& config) const; /** Source file kinds (classifications). Generators use this to decide how to treat a source file. */ @@ -350,6 +352,9 @@ public: std::string GetFullNameImported(const std::string& config, bool implib) const; + /** Get source files common to all configurations and diagnose cases + with per-config sources. Excludes sources added by a TARGET_OBJECTS + generator expression. */ bool GetConfigCommonSourceFiles(std::vector& files) const; bool HaveBuildTreeRPATH(const std::string& config) const; -- cgit v1.2.1