summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-03 18:52:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-03 18:53:05 (GMT)
commit040ee747c35d52be0921cd46aff103bef9408f46 (patch)
treea09bd4b2dd16d7c1a5084aec06786c5915ff9f0d
parentc51953981ce846f01d152689839db816a6a0e6af (diff)
parenteebf239d9c723b9c6d4a56468963c012a9ab442c (diff)
downloadCMake-040ee747c35d52be0921cd46aff103bef9408f46.zip
CMake-040ee747c35d52be0921cd46aff103bef9408f46.tar.gz
CMake-040ee747c35d52be0921cd46aff103bef9408f46.tar.bz2
Merge topic 'cxxmodules-no-compile-commands-modmap'
eebf239d9c Merge branch 'cxxmodules-no-compile-commands-modmap-release' into cxxmodules-no-compile-commands-modmap 73fbad3d93 cmNinjaTargetGenerator: use scan flag for modmap usage in exported commands Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9100
-rw-r--r--Source/cmNinjaTargetGenerator.cxx22
-rw-r--r--Source/cmNinjaTargetGenerator.h2
2 files changed, 12 insertions, 12 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 2cb1284..7ea479e 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1390,8 +1390,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
bool const needDyndep = !isPch &&
this->GeneratorTarget->NeedDyndepForSource(language, config, source);
- cmNinjaBuild objBuild(this->LanguageCompilerRule(
- language, config, needDyndep ? WithScanning::Yes : WithScanning::No));
+ WithScanning withScanning =
+ needDyndep ? WithScanning::Yes : WithScanning::No;
+ cmNinjaBuild objBuild(
+ this->LanguageCompilerRule(language, config, withScanning));
cmNinjaVars& vars = objBuild.Variables;
vars["FLAGS"] =
this->ComputeFlagsForObject(source, language, config, objectFileName);
@@ -1454,7 +1456,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->ExportObjectCompileCommand(
language, sourceFilePath, objectDir, objectFileName, objectFileDir,
vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"],
- vars["TARGET_COMPILE_PDB"], vars["TARGET_PDB"], config);
+ vars["TARGET_COMPILE_PDB"], vars["TARGET_PDB"], config, withScanning);
}
objBuild.Outputs.push_back(objectFileName);
@@ -1801,7 +1803,7 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
this->ExportObjectCompileCommand(
language, sourceFilePath, bmiDir, bmiFileName, bmiFileDir, vars["FLAGS"],
vars["DEFINES"], vars["INCLUDES"], vars["TARGET_COMPILE_PDB"],
- vars["TARGET_PDB"], config);
+ vars["TARGET_PDB"], config, WithScanning::Yes);
}
bmiBuild.Outputs.push_back(bmiFileName);
@@ -2031,7 +2033,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
language, sourceFilePath, objectDir, targetObjectFilename,
cmSystemTools::GetFilenamePath(targetObjectFilename), vars["FLAGS"],
vars["DEFINES"], vars["INCLUDES"],
- /*compile pdb*/ "", /*target pdb*/ "", config);
+ /*compile pdb*/ "", /*target pdb*/ "", config, WithScanning::No);
}
} else {
// Object outputs
@@ -2051,7 +2053,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
cmSystemTools::GetFilenamePath(objectFilepath), vars["FLAGS"],
vars["DEFINES"], vars["INCLUDES"],
/*compile pdb*/ "",
- /*target pdb*/ "", config);
+ /*target pdb*/ "", config, WithScanning::No);
}
}
}
@@ -2220,7 +2222,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
std::string const& objectFileDir, std::string const& flags,
std::string const& defines, std::string const& includes,
std::string const& targetCompilePdb, std::string const& targetPdb,
- std::string const& outputConfig)
+ std::string const& outputConfig, WithScanning withScanning)
{
if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) {
return;
@@ -2243,14 +2245,12 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
escapedSourceFileName, cmOutputConverter::SHELL);
std::string fullFlags = flags;
- {
- bool const needDyndep =
- this->GetGeneratorTarget()->NeedDyndep(language, outputConfig);
+ if (withScanning == WithScanning::Yes) {
std::string const modmapFormatVar =
cmStrCat("CMAKE_", language, "_MODULE_MAP_FORMAT");
std::string const modmapFormat =
this->Makefile->GetSafeDefinition(modmapFormatVar);
- if (needDyndep && !modmapFormat.empty()) {
+ if (!modmapFormat.empty()) {
std::string modmapFlags = this->GetMakefile()->GetRequiredDefinition(
cmStrCat("CMAKE_", language, "_MODULE_MAP_FLAG"));
// XXX(modmap): If changing this path construction, change
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 7a68599..b55c460 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -193,7 +193,7 @@ protected:
std::string const& objectFileDir, std::string const& flags,
std::string const& defines, std::string const& includes,
std::string const& targetCompilePdb, std::string const& targetPdb,
- std::string const& outputConfig);
+ std::string const& outputConfig, WithScanning withScanning);
void AdditionalCleanFiles(const std::string& config);