summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-27 15:21:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-27 15:22:05 (GMT)
commit2a12a83037dead14173fcf0219f4669229c67147 (patch)
treee2a56e2c491ef1b65610b309f81b5a17d329d269 /Source
parent81d863b60aa40c42f08736abbc3fa6715b553240 (diff)
parent3b632f32fae72ab70f752dd1e22ced40b7a81537 (diff)
downloadCMake-2a12a83037dead14173fcf0219f4669229c67147.zip
CMake-2a12a83037dead14173fcf0219f4669229c67147.tar.gz
CMake-2a12a83037dead14173fcf0219f4669229c67147.tar.bz2
Merge topic 'misc-cxxmodule-fixes'
3b632f32fa Tests/CXXModules: forward the default build type 5ab6b09691 Tests/CXXModules: fix multi-config and MSVC details 11b62ef118 Tests/CXXModules: add missing `bmi-only` and compiler id fields 5d9631fbdd Tests/CXXModules: fix key set mismatch error messages 86e7fb72cb Tests/CXXModules: use a less generic name for the config 6b940dc590 Tests/CXXModules: replace the object extension as well 1c9f83c8ec Tests/CXXModules: fix error detection propagation 7a4c02cb38 cmGlobalGenerator: factor out messaging for CMP0037 ... Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com> Merge-request: !8834
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx10
-rw-r--r--Source/cmGlobalGenerator.cxx32
2 files changed, 21 insertions, 21 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ca38be6..181ffd1 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4287,9 +4287,6 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
- filename = cmStrCat(
- generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/");
-
const std::map<std::string, std::string> languageToExtension = {
{ "C", ".h" },
{ "CXX", ".hxx" },
@@ -4297,8 +4294,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
{ "OBJCXX", ".objcxx.hxx" }
};
- filename =
- cmStrCat(filename, "CMakeFiles/", generatorTarget->GetName(), ".dir");
+ filename = generatorTarget->GetSupportDirectory();
if (this->GetGlobalGenerator()->IsMultiConfig()) {
filename = cmStrCat(filename, "/", config);
@@ -4391,9 +4387,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config,
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
}
- filename =
- cmStrCat(generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(),
- "/CMakeFiles/", generatorTarget->GetName(), ".dir/cmake_pch");
+ filename = cmStrCat(generatorTarget->GetSupportDirectory(), "/cmake_pch");
// For GCC the source extension will be transformed into .h[xx].gch
if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) {
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d5099ee..933e754 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2690,13 +2690,9 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path,
return cm::nullopt;
}
-bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
- std::string const& reason) const
+static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
+ std::string const& reason)
{
- cmTarget* tgt = this->FindTarget(targetName);
- if (!tgt) {
- return true;
- }
MessageType messageType = MessageType::AUTHOR_WARNING;
std::ostringstream e;
bool issueMessage = false;
@@ -2715,13 +2711,12 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
break;
}
if (issueMessage) {
- e << "The target name \"" << targetName << "\" is reserved " << reason
+ e << "The target name \"" << tgt->GetName() << "\" is reserved " << reason
<< ".";
if (messageType == MessageType::AUTHOR_WARNING) {
e << " It may result in undefined behavior.";
}
- this->GetCMakeInstance()->IssueMessage(messageType, e.str(),
- tgt->GetBacktrace());
+ cm->IssueMessage(messageType, e.str(), tgt->GetBacktrace());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
@@ -2729,6 +2724,16 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
return true;
}
+bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
+ std::string const& reason) const
+{
+ cmTarget* tgt = this->FindTarget(targetName);
+ if (!tgt) {
+ return true;
+ }
+ return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, reason);
+}
+
void cmGlobalGenerator::CreateDefaultGlobalTargets(
std::vector<GlobalTargetInfo>& targets)
{
@@ -3142,10 +3147,11 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
// by one or more of the cmake generators.
// Adding additional targets to this list will require a policy!
- const char* reservedTargets[] = { "all", "ALL_BUILD", "help",
- "install", "INSTALL", "preinstall",
- "clean", "edit_cache", "rebuild_cache",
- "ZERO_CHECK" };
+ static const cm::static_string_view reservedTargets[] = {
+ "all"_s, "ALL_BUILD"_s, "help"_s, "install"_s,
+ "INSTALL"_s, "preinstall"_s, "clean"_s, "edit_cache"_s,
+ "rebuild_cache"_s, "ZERO_CHECK"_s
+ };
return cm::contains(reservedTargets, name);
}