diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-18 15:15:15 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-04-02 21:12:56 (GMT) |
commit | 5702e10677e72a75370e8c1bbe6f10fa5ad675a9 (patch) | |
tree | 0820653eda131344091b81e756120cf881ccf047 /Source/cmTarget.cxx | |
parent | 857d30b52ef2fb011bad16249d34972fadae9b70 (diff) | |
download | CMake-5702e10677e72a75370e8c1bbe6f10fa5ad675a9.zip CMake-5702e10677e72a75370e8c1bbe6f10fa5ad675a9.tar.gz CMake-5702e10677e72a75370e8c1bbe6f10fa5ad675a9.tar.bz2 |
cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
Add policy CMP0051 to control this behavior.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8bfc428..04ae5af 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -556,6 +556,10 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files) const i != srcs.end(); ++i) { std::string src = *i; + if (cmGeneratorExpression::Find(src) != std::string::npos) + { + continue; + } cmSourceFile* sf = this->Makefile->GetOrCreateSource(src); std::string e; src = sf->GetFullPath(&e); @@ -743,6 +747,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr) { std::string objLibName = expr.substr(17, expr.size()-18); this->ObjectLibraries.push_back(objLibName); + this->AddSource(expr); } else { @@ -2876,20 +2881,62 @@ const char *cmTarget::GetProperty(const std::string& prop, for (std::vector<std::string>::const_iterator li = files.begin(); li != files.end(); ++li) { - cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); - // Construct what is known about this source file location. - cmSourceFileLocation const& location = sf->GetLocation(); - std::string sname = location.GetDirectory(); - if(!sname.empty()) + if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && + (*li)[li->size() - 1] == '>') { - sname += "/"; + std::string objLibName = li->substr(17, li->size()-18); + + bool addContent = false; + bool noMessage = true; + cmOStringStream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0051)) + { + case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n"; + noMessage = false; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + addContent = true; + } + if (!noMessage) + { + e << "Target \"" << this->Name << "\" contains $<TARGET_OBJECTS> " + "generator expression in its sources list. This content was not " + "previously part of the SOURCES property when that property was " + "read at configure time. Code reading that property needs to be " + "adapted to ignore the generator expression using the " + "string(GENEX_STRIP) command."; + this->Makefile->IssueMessage(messageType, e.str()); + } + if (addContent) + { + ss << sep; + sep = ";"; + ss << *li; + } } - sname += location.GetName(); + else + { + cmSourceFile *sf = this->Makefile->GetOrCreateSource(*li); + // Construct what is known about this source file location. + cmSourceFileLocation const& location = sf->GetLocation(); + std::string sname = location.GetDirectory(); + if(!sname.empty()) + { + sname += "/"; + } + sname += location.GetName(); - ss << sep; - sep = ";"; - // Append this list entry. - ss << sname; + ss << sep; + sep = ";"; + // Append this list entry. + ss << sname; + } } } this->Properties.SetProperty("SOURCES", ss.str().c_str(), |