diff options
author | Brad King <brad.king@kitware.com> | 2014-12-01 13:55:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-12-01 13:55:45 (GMT) |
commit | 58d3898083e1bf66f4ecf2e82a556e81f67ce5bc (patch) | |
tree | 582d63921aab0ef0e91ebbb6913999418476fed2 /Source | |
parent | baa283f9226a8c599523e9265cb85b809740ab31 (diff) | |
parent | 8a75c7ef32af391cb45af889d266e2a77daa61d6 (diff) | |
download | CMake-58d3898083e1bf66f4ecf2e82a556e81f67ce5bc.zip CMake-58d3898083e1bf66f4ecf2e82a556e81f67ce5bc.tar.gz CMake-58d3898083e1bf66f4ecf2e82a556e81f67ce5bc.tar.bz2 |
Merge branch 'target-sources-error-conditions' into release
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 26 |
3 files changed, 44 insertions, 3 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 30a52d4..134ee98 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -68,6 +68,16 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei != this->Exports.end(); ++tei) { cmTarget* te = *tei; + if (te->GetProperty("INTERFACE_SOURCES")) + { + cmOStringStream e; + e << "Target \"" + << te->GetName() + << "\" has a populated INTERFACE_SOURCES property. This is not " + "currently supported."; + cmSystemTools::Error(e.str().c_str()); + return false; + } this->GenerateImportTargetCode(os, te); te->AppendBuildInterfaceIncludes(); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 89071c0..23180f1 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -123,6 +123,17 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { cmTarget* te = (*tei)->Target; + if (te->GetProperty("INTERFACE_SOURCES")) + { + cmOStringStream e; + e << "Target \"" + << te->GetName() + << "\" has a populated INTERFACE_SOURCES property. This is not " + "currently supported."; + cmSystemTools::Error(e.str().c_str()); + return false; + } + requiresConfigFiles = requiresConfigFiles || te->GetType() != cmTarget::INTERFACE_LIBRARY; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b476a27..ad1c83e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -649,6 +649,8 @@ static bool processSources(cmTarget const* tgt, for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { + cmLinkImplItem const& item = (*it)->LinkImplItem; + std::string const& targetName = item; std::vector<std::string> entrySources; cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, config, @@ -667,11 +669,10 @@ static bool processSources(cmTarget const* tgt, i != entrySources.end(); ++i) { std::string& src = *i; - cmSourceFile* sf = mf->GetOrCreateSource(src); std::string e; - src = sf->GetFullPath(&e); - if(src.empty()) + std::string fullPath = sf->GetFullPath(&e); + if(fullPath.empty()) { if(!e.empty()) { @@ -681,6 +682,25 @@ static bool processSources(cmTarget const* tgt, } return contextDependent; } + + if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) + { + cmOStringStream err; + if (!targetName.empty()) + { + err << "Target \"" << targetName << "\" contains relative " + "path in its INTERFACE_SOURCES:\n" + " \"" << src << "\""; + } + else + { + err << "Found relative path while evaluating sources of " + "\"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; + } + tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, err.str()); + return contextDependent; + } + src = fullPath; } std::string usedSources; for(std::vector<std::string>::iterator |