[Cmake-commits] CMake branch, next, updated. v3.3.0-rc3-913-g2685880

Brad King brad.king at kitware.com
Wed Jul 8 13:24:07 EDT 2015


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  2685880c4ab31b159ebcbffdd5fd99ffb305b86a (commit)
       via  7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6 (commit)
      from  6fdf1bdacf56d22121af6d0997ed88abce838f25 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2685880c4ab31b159ebcbffdd5fd99ffb305b86a
commit 2685880c4ab31b159ebcbffdd5fd99ffb305b86a
Merge: 6fdf1bd 7aa9e80
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 8 13:24:06 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jul 8 13:24:06 2015 -0400

    Merge topic 'empty-LINK_LIBRARIES' into next
    
    7aa9e80e set_property: Fix crash when setting LINK_LIBRARIES to nothing


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6
commit 7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 8 13:14:37 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 8 13:23:16 2015 -0400

    set_property: Fix crash when setting LINK_LIBRARIES to nothing
    
    We use a special dedicated structure to store the LINK_LIBRARIES target
    property.  Do not try to construct a string from a NULL value.  Instead
    leave the property structure empty when no value is given.
    
    Reported-by: Ghyslain Leclerc <ghleclerc at gmail.com>

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 70005b4..2d34747 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1748,9 +1748,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
   else if (prop == "LINK_LIBRARIES")
     {
     this->Internal->LinkImplementationPropertyEntries.clear();
-    cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
-    cmValueWithOrigin entry(value, lfbt);
-    this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+    if (value)
+      {
+      cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+      cmValueWithOrigin entry(value, lfbt);
+      this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+      }
     }
   else if (prop == "SOURCES")
     {
@@ -1834,9 +1837,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
     }
   else if (prop == "LINK_LIBRARIES")
     {
-    cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
-    cmValueWithOrigin entry(value, lfbt);
-    this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+    if (value)
+      {
+      cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+      cmValueWithOrigin entry(value, lfbt);
+      this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+      }
     }
   else if (prop == "SOURCES")
     {
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 592b5e4..81029cd 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -146,6 +146,7 @@ add_RunCMake_test(list)
 add_RunCMake_test(message)
 add_RunCMake_test(project)
 add_RunCMake_test(return)
+add_RunCMake_test(set_property)
 add_RunCMake_test(string)
 add_RunCMake_test(try_compile)
 add_RunCMake_test(try_run)
diff --git a/Tests/RunCMake/set_property/CMakeLists.txt b/Tests/RunCMake/set_property/CMakeLists.txt
new file mode 100644
index 0000000..18dfd26
--- /dev/null
+++ b/Tests/RunCMake/set_property/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
new file mode 100644
index 0000000..994e874
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
@@ -0,0 +1,7 @@
+add_custom_target(CustomTarget)
+set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES)
+set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES)
+get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES)
+if (NOT "${val}" STREQUAL "")
+  message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''")
+endif()
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
new file mode 100644
index 0000000..54e63f7
--- /dev/null
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(LINK_LIBRARIES)

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

Summary of changes:
 Source/cmTarget.cxx                                  |   18 ++++++++++++------
 Tests/RunCMake/CMakeLists.txt                        |    1 +
 .../{AutoExportDll => set_property}/CMakeLists.txt   |    0
 Tests/RunCMake/set_property/LINK_LIBRARIES.cmake     |    7 +++++++
 Tests/RunCMake/set_property/RunCMakeTest.cmake       |    3 +++
 5 files changed, 23 insertions(+), 6 deletions(-)
 copy Tests/RunCMake/{AutoExportDll => set_property}/CMakeLists.txt (100%)
 create mode 100644 Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
 create mode 100644 Tests/RunCMake/set_property/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list