[Cmake-commits] CMake branch, next, updated. v3.8.0-771-gccd80a7

Kitware Robot kwrobot at kitware.com
Mon Apr 17 13:55:03 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  ccd80a7a9ad29ff9ce9565377b8cc9a8be74edff (commit)
       via  5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3 (commit)
      from  be2c45f2a98d69cc9952b592777bb506f69149a2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccd80a7a9ad29ff9ce9565377b8cc9a8be74edff
commit ccd80a7a9ad29ff9ce9565377b8cc9a8be74edff
Merge: be2c45f 5e616fc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 17 17:52:11 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Apr 17 13:52:15 2017 -0400

    Stage topic 'fix-CMP0026-old'
    
    Topic-id: 23702
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/710


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3
commit 5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 17 09:29:49 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 17 10:10:15 2017 -0400

    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 at kitware.com>

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();
diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
new file mode 100644
index 0000000..80497a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+
+cmake_policy(SET CMP0026 OLD)
+
+set(out ${CMAKE_CURRENT_BINARY_DIR}/out.txt)
+
+add_library(somelib empty.cpp ${out})
+get_target_property(_loc somelib LOCATION)
+
+file(WRITE "${out}"
+  "source file written by project code after getting target LOCATION\n"
+  )
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index 6331717..047da28 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -1,6 +1,7 @@
 include(RunCMake)
 
 run_cmake(CMP0026-WARN)
+run_cmake(CMP0026-OLD)
 run_cmake(CMP0026-NEW)
 run_cmake(CMP0026-IMPORTED)
 run_cmake(CMP0026-CONFIG-LOCATION-NEW)

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGeneratorTarget.cxx              |   20 ++++++++++++++++++++
 Tests/RunCMake/CMP0026/CMP0026-OLD.cmake  |   12 ++++++++++++
 Tests/RunCMake/CMP0026/RunCMakeTest.cmake |    1 +
 3 files changed, 33 insertions(+)
 create mode 100644 Tests/RunCMake/CMP0026/CMP0026-OLD.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list