summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-08 13:27:29 -0400
committerBrad King <brad.king@kitware.com>2015-07-08 13:27:29 -0400
commitd805767545bd4829db4fa1bd2724042f895a2cd9 (patch)
tree5ac956752674d4b912c3f7e505ec26d39a763087
parente7c33efa1520401cdc1f71b4c37cf1ffa6da3f78 (diff)
parent7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6 (diff)
downloadcmake-d805767545bd4829db4fa1bd2724042f895a2cd9.tar.gz
Merge branch 'empty-LINK_LIBRARIES' into release
-rw-r--r--Source/cmTarget.cxx18
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/set_property/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/set_property/LINK_LIBRARIES.cmake7
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake3
5 files changed, 26 insertions, 6 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4def889056..20d3208cf6 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 592b5e4069..81029cdcc3 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 0000000000..18dfd2686f
--- /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 0000000000..994e874ef8
--- /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 0000000000..54e63f75c5
--- /dev/null
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(LINK_LIBRARIES)