summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-09-20 17:42:57 (GMT)
committerBrad King <brad.king@kitware.com>2024-09-20 17:45:45 (GMT)
commit3ce26c57ba06b5a02e153b8bb16eb8c60938e4ce (patch)
tree7c48168b96da81fc701ea4d1868f7ad621734606
parentfdceee50e6c2bba0cd1903e13b3c63327cb3d53e (diff)
downloadCMake-3ce26c57ba06b5a02e153b8bb16eb8c60938e4ce.zip
CMake-3ce26c57ba06b5a02e153b8bb16eb8c60938e4ce.tar.gz
CMake-3ce26c57ba06b5a02e153b8bb16eb8c60938e4ce.tar.bz2
cmMakefileTargetGenerator: Avoid crash on GetLinkInformation failure
-rw-r--r--Source/cmMakefileTargetGenerator.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9ff0a4a..9d0d466 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2206,13 +2206,14 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
bool useResponseFile, std::vector<std::string>& makefile_depends,
std::string const& linkLanguage, ResponseFlagFor responseMode)
{
- std::string frameworkPath;
- std::string linkPath;
- cmComputeLinkInformation* pcli =
- this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
- this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
- frameworkPath, linkPath);
- linkLibs = frameworkPath + linkPath + linkLibs;
+ if (cmComputeLinkInformation* pcli =
+ this->GeneratorTarget->GetLinkInformation(this->GetConfigName())) {
+ std::string frameworkPath;
+ std::string linkPath;
+ this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath);
+ linkLibs = frameworkPath + linkPath + linkLibs;
+ }
if (useResponseFile &&
linkLibs.find_first_not_of(' ') != std::string::npos) {