mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
LINKER_TYPE: Support MOLD only on GCC versions that support it
Fixes: #25748
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
@@ -5585,11 +5586,22 @@ std::string cmGeneratorTarget::GetLinkerTool(const std::string& lang,
|
||||
linkerTool = this->Makefile->GetDefinition("CMAKE_LINKER");
|
||||
|
||||
if (linkerType != "DEFAULT"_s) {
|
||||
this->LocalGenerator->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown. Did you forget to define '", usingLinker,
|
||||
"' variable?"));
|
||||
auto isCMakeLinkerType = [](const std::string& type) -> bool {
|
||||
return std::all_of(type.cbegin(), type.cend(),
|
||||
[](char c) { return std::isupper(c); });
|
||||
};
|
||||
if (isCMakeLinkerType(linkerType)) {
|
||||
this->LocalGenerator->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown or not supported by this toolchain."));
|
||||
} else {
|
||||
this->LocalGenerator->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown. Did you forget to define the '", usingLinker,
|
||||
"' variable?"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <initializer_list>
|
||||
@@ -3357,10 +3358,22 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
|
||||
this->AppendFlags(flags, linkerFlags);
|
||||
}
|
||||
} else if (linkerType != "DEFAULT"_s) {
|
||||
this->IssueMessage(MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown. Did you forget to define '",
|
||||
usingLinker, "' variable?"));
|
||||
auto isCMakeLinkerType = [](const std::string& type) -> bool {
|
||||
return std::all_of(type.cbegin(), type.cend(),
|
||||
[](char c) { return std::isupper(c); });
|
||||
};
|
||||
if (isCMakeLinkerType(linkerType)) {
|
||||
this->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown or not supported by this toolchain."));
|
||||
} else {
|
||||
this->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("LINKER_TYPE '", linkerType,
|
||||
"' is unknown. Did you forget to define the '", usingLinker,
|
||||
"' variable?"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user