summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-09 15:24:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-09 15:25:25 (GMT)
commita09e9f98c0cca6baae9e47b388058e14ddcfa4da (patch)
tree597079841b420c90c112bb17e024238fbdff4af4
parent517273c7906b0f9a3f4353dd8b1f7b1520623c4e (diff)
parenta46fdda46422c4d41afc44a5df02104acfee78ba (diff)
downloadCMake-a09e9f98c0cca6baae9e47b388058e14ddcfa4da.zip
CMake-a09e9f98c0cca6baae9e47b388058e14ddcfa4da.tar.gz
CMake-a09e9f98c0cca6baae9e47b388058e14ddcfa4da.tar.bz2
Merge topic 'fix-crash-21165'
a46fdda464 cmGeneratorTarget: Avoid missing nullptr check Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5191
-rw-r--r--Source/cmGeneratorTarget.cxx34
1 files changed, 12 insertions, 22 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f8568b3..1bb069f 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6472,21 +6472,16 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(artifact);
- const char* propertyName = nullptr;
- std::string propertyNameStr = targetTypeName;
- if (!propertyNameStr.empty()) {
- propertyNameStr += "_OUTPUT_DIRECTORY";
- propertyName = propertyNameStr.c_str();
+ std::string propertyName;
+ if (!targetTypeName.empty()) {
+ propertyName = cmStrCat(targetTypeName, "_OUTPUT_DIRECTORY");
}
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = nullptr;
- std::string configPropStr = targetTypeName;
- if (!configPropStr.empty()) {
- configPropStr += "_OUTPUT_DIRECTORY_";
- configPropStr += configUpper;
- configProp = configPropStr.c_str();
+ std::string configProp;
+ if (!targetTypeName.empty()) {
+ configProp = cmStrCat(targetTypeName, "_OUTPUT_DIRECTORY_", configUpper);
}
// Select an output directory.
@@ -6547,22 +6542,17 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
{
// Look for a target property defining the target output directory
// based on the target type.
- const char* propertyName = nullptr;
- std::string propertyNameStr = kind;
- if (!propertyNameStr.empty()) {
- propertyNameStr += "_OUTPUT_DIRECTORY";
- propertyName = propertyNameStr.c_str();
+ std::string propertyName;
+ if (!kind.empty()) {
+ propertyName = cmStrCat(kind, "_OUTPUT_DIRECTORY");
}
std::string conf = config;
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = nullptr;
- std::string configPropStr = kind;
- if (!configPropStr.empty()) {
- configPropStr += "_OUTPUT_DIRECTORY_";
- configPropStr += configUpper;
- configProp = configPropStr.c_str();
+ std::string configProp;
+ if (!kind.empty()) {
+ configProp = cmStrCat(kind, "_OUTPUT_DIRECTORY_", configUpper);
}
// Select an output directory.