diff options
author | Brad King <brad.king@kitware.com> | 2014-12-01 13:57:34 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-12-01 13:57:34 (GMT) |
commit | 8e75f1d2fa3049ac31f4ebdbc255fca3e6414802 (patch) | |
tree | 4bb6af9da45afae0e91c2b19085157cbacc692fd /Source/cmTarget.cxx | |
parent | 2a92231630b6aee671c7f4e8b64f69cfd172b9e3 (diff) | |
parent | 8a75c7ef32af391cb45af889d266e2a77daa61d6 (diff) | |
download | CMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.zip CMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.tar.gz CMake-8e75f1d2fa3049ac31f4ebdbc255fca3e6414802.tar.bz2 |
Merge topic 'target-sources-error-conditions'
8a75c7ef Help: Document the export limitation of INTERFACE_SOURCES.
e1348056 Export: Disallow export of targets with INTERFACE_SOURCES
bb5905bb cmTarget: Don't allow relative paths in INTERFACE_SOURCES
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index edae18f..f0957d0 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 |