diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-22 21:18:18 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-22 21:18:18 (GMT) |
commit | 73fbad3d93c8d2d7a415cbbcbe01d3370fd71fa6 (patch) | |
tree | 7e2ec14b11552ce22e61d7581666b09a51547b3b /Source/cmNinjaTargetGenerator.cxx | |
parent | 158316dc0c0fb856feb67ca3cacd7681170b5e0a (diff) | |
download | CMake-73fbad3d93c8d2d7a415cbbcbe01d3370fd71fa6.zip CMake-73fbad3d93c8d2d7a415cbbcbe01d3370fd71fa6.tar.gz CMake-73fbad3d93c8d2d7a415cbbcbe01d3370fd71fa6.tar.bz2 |
cmNinjaTargetGenerator: use scan flag for modmap usage in exported commands
See: https://discourse.cmake.org/t/how-to-control-the-location-of-the-c-20-binary-module-interface-bmi-output-directory/7968
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4025918..1d90194 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1373,8 +1373,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); @@ -1434,7 +1436,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( if (firstForConfig) { this->ExportObjectCompileCommand( language, sourceFilePath, objectDir, objectFileName, objectFileDir, - vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config); + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config, withScanning); } objBuild.Outputs.push_back(objectFileName); @@ -1780,7 +1782,7 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement( if (firstForConfig) { this->ExportObjectCompileCommand( language, sourceFilePath, bmiDir, bmiFileName, bmiFileDir, vars["FLAGS"], - vars["DEFINES"], vars["INCLUDES"], config); + vars["DEFINES"], vars["INCLUDES"], config, WithScanning::Yes); } bmiBuild.Outputs.push_back(bmiFileName); @@ -1992,7 +1994,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( std::string const& objectDir, std::string const& objectFileName, std::string const& objectFileDir, std::string const& flags, std::string const& defines, std::string const& includes, - std::string const& outputConfig) + std::string const& outputConfig, WithScanning withScanning) { if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) { return; @@ -2015,14 +2017,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 |