[Cmake-commits] CMake branch, next, updated. v3.5.2-839-g667fa6f

Brad King brad.king at kitware.com
Thu Jun 2 11:07:40 EDT 2016


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  667fa6f4fad2141543bca97b74fb956df4d5a9ec (commit)
       via  f500a784d008566d6eb6301b7c6a0f07847b856d (commit)
      from  a53a9b28e905650205db7e02499f8484b216d3ad (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=667fa6f4fad2141543bca97b74fb956df4d5a9ec
commit 667fa6f4fad2141543bca97b74fb956df4d5a9ec
Merge: a53a9b2 f500a78
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 2 11:07:38 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 2 11:07:38 2016 -0400

    Merge topic 'fix-TARGET_PROPERTY-LOCATION-crash' into next
    
    f500a784 Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f500a784d008566d6eb6301b7c6a0f07847b856d
commit f500a784d008566d6eb6301b7c6a0f07847b856d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 2 10:57:10 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 2 10:58:38 2016 -0400

    Fix crash on $<TARGET_PROPERTY:...,LOCATION> genex (#16134)
    
    Policy CMP0026 deprecated the LOCATION property, and we have long
    provided a $<TARGET_FILE:...> generator expression.  However, if
    a project tries to use $<TARGET_PROPERTY:...,LOCATION> we should
    at least not crash.
    
    The compatibility implementation of the LOCATION property uses
    cmGlobalGenerator::CreateGenerationObjects to create the structures
    needed to evaluate the property before generation starts.  The
    implementation assumed that accessing the property could only be done
    during configuration (via the typical get_property command use case).
    The $<TARGET_PROPERTY:...,LOCATION> genex causes the LOCATION property
    to be accessed during generation.  Calling CreateGenerationObjects
    during generation blows away all the objects currently being used for
    generation and is not safe.  Add a condition to call it only when
    configuration is not finished.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5e0d2b7..f435a1d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1131,7 +1131,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
         // target because the configuration type may not be known at
         // CMake time.
         cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
-        gg->CreateGenerationObjects();
+        if (!gg->GetConfigureDoneCMP0026()) {
+          gg->CreateGenerationObjects();
+        }
         cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
         this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild());
       }
@@ -1150,7 +1152,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
           prop, this->ImportedGetFullPath(configName, false).c_str());
       } else {
         cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
-        gg->CreateGenerationObjects();
+        if (!gg->GetConfigureDoneCMP0026()) {
+          gg->CreateGenerationObjects();
+        }
         cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
         this->Properties.SetProperty(
           prop, gt->GetFullPath(configName, false).c_str());
@@ -1168,7 +1172,9 @@ const char* cmTarget::GetProperty(const std::string& prop,
             prop, this->ImportedGetFullPath(configName, false).c_str());
         } else {
           cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
-          gg->CreateGenerationObjects();
+          if (!gg->GetConfigureDoneCMP0026()) {
+            gg->CreateGenerationObjects();
+          }
           cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName());
           this->Properties.SetProperty(
             prop, gt->GetFullPath(configName, false).c_str());
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 45175d8..625bab2 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -28,6 +28,7 @@ run_cmake(COMPILE_LANGUAGE-add_test)
 run_cmake(COMPILE_LANGUAGE-unknown-lang)
 run_cmake(TARGET_FILE-recursion)
 run_cmake(OUTPUT_NAME-recursion)
+run_cmake(TARGET_PROPERTY-LOCATION)
 
 run_cmake(ImportedTarget-TARGET_PDB_FILE)
 if(LINKER_SUPPORTS_PDB)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
new file mode 100644
index 0000000..e4dbb71
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Policy CMP0026 is not set: Disallow use of the LOCATION target property.
+  Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policy
+  command to set the policy and suppress this warning.
+
+  The LOCATION property should not be read from target "foo".  Use the target
+  name directly with add_custom_command, or use the generator expression
+  \$<TARGET_FILE>, as appropriate.
+
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake
new file mode 100644
index 0000000..8929cdb
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(foo empty.c)
+add_custom_target(drive COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,LOCATION>)

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

Summary of changes:
 Source/cmTarget.cxx                                        |   12 +++++++++---
 Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake      |    1 +
 .../TARGET_PROPERTY-LOCATION-stderr.txt}                   |    6 ++----
 .../GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake     |    3 +++
 4 files changed, 15 insertions(+), 7 deletions(-)
 copy Tests/RunCMake/{CMP0026/LOCATION-and-TARGET_OBJECTS-stderr.txt => GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt} (63%)
 create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list