summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-08 17:14:37 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-08 17:23:16 (GMT)
commit7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6 (patch)
treeedd7720bb6887c86b3dca7754662ab6335dba1db /Source
parenta6916a6c6e397bda8b381f65dbfc59d3c52f8525 (diff)
downloadCMake-7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6.zip
CMake-7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6.tar.gz
CMake-7aa9e80e35f62ec5686d08b49ebe8b57cbc6cbc6.tar.bz2
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@gmail.com>
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx18
1 files changed, 12 insertions, 6 deletions
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")
{