summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-17 13:29:49 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-17 14:10:15 (GMT)
commit5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3 (patch)
tree0a0e49bb95bcdddb5f548e0416221d88920e1fe2 /Source/cmGeneratorTarget.cxx
parent60307c5056476962d7656ea9122ada79a07aa58f (diff)
downloadCMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.zip
CMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.tar.gz
CMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.tar.bz2
CMP0026: Fix OLD behavior with file written during configure step
Refactoring in commit 60307c5056 (cmGeneratorTarget: Replace source classifier implementation, 2017-04-07) accidentally regressed support for CMP0026's OLD behavior in the case of a source file written by project code during the configure step after getting a LOCATION. We should not perform full source classification until the generate step because files written by the project's configure step may not exist yet. Add special logic to support this case. Add a test case for it. Reported-by: David Stoup <david.stoup@kitware.com>
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6779641..e84bf4e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -947,6 +947,26 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files,
const std::string& config) const
{
+ if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
+ // Since we are still configuring not all sources may exist yet,
+ // so we need to avoid full source classification because that
+ // requires the absolute paths to all sources to be determined.
+ // Since this is only for compatibility with old policies that
+ // projects should not depend on anymore, just compute the files
+ // without memoizing them.
+ std::vector<std::string> srcs;
+ this->GetSourceFiles(srcs, config);
+ std::set<cmSourceFile*> emitted;
+ for (std::vector<std::string>::const_iterator i = srcs.begin();
+ i != srcs.end(); ++i) {
+ cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
+ if (emitted.insert(sf).second) {
+ files.push_back(sf);
+ }
+ }
+ return;
+ }
+
KindedSources const& kinded = this->GetKindedSources(config);
files.reserve(kinded.Sources.size());
for (std::vector<SourceAndKind>::const_iterator si = kinded.Sources.begin();