mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 04:08:46 -06:00
Merge topic 'cxxmodules-pch'
40dc13b242cmNinjaTargetGenerator: PCH files do not need dyndepf61c64cd1ccmLocalGenerator: prevent scanning of PCH source filesea8c37b759Tests/CXXModules: add a test which scans a PCH-using source Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9032
This commit is contained in:
@@ -2739,6 +2739,9 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
|
||||
auto* pch_sf = this->Makefile->GetOrCreateSource(
|
||||
pchSource, false, cmSourceFileLocationKind::Known);
|
||||
// PCH sources should never be scanned as they cannot contain C++
|
||||
// module references.
|
||||
pch_sf->SetProperty("CXX_SCAN_FOR_MODULES", "0");
|
||||
|
||||
if (!this->GetGlobalGenerator()->IsXcode()) {
|
||||
if (!ReuseFrom) {
|
||||
|
||||
@@ -1367,7 +1367,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
|
||||
!(language == "RC" || (language == "CUDA" && !flag));
|
||||
int const commandLineLengthLimit =
|
||||
((lang_supports_response && this->ForceResponseFile())) ? -1 : 0;
|
||||
bool const needDyndep =
|
||||
cmValue pchExtension =
|
||||
this->GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
|
||||
bool const isPch = cmHasSuffix(objectFileName, pchExtension);
|
||||
bool const needDyndep = !isPch &&
|
||||
this->GeneratorTarget->NeedDyndepForSource(language, config, source);
|
||||
|
||||
cmNinjaBuild objBuild(this->LanguageCompilerRule(
|
||||
@@ -1438,13 +1441,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
|
||||
}
|
||||
|
||||
objBuild.Outputs.push_back(objectFileName);
|
||||
if (firstForConfig) {
|
||||
cmValue pchExtension =
|
||||
this->GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
|
||||
if (!cmHasSuffix(objectFileName, pchExtension)) {
|
||||
// Add this object to the list of object files.
|
||||
this->Configs[config].Objects.push_back(objectFileName);
|
||||
}
|
||||
if (firstForConfig && !isPch) {
|
||||
// Add this object to the list of object files.
|
||||
this->Configs[config].Objects.push_back(objectFileName);
|
||||
}
|
||||
|
||||
objBuild.ExplicitDeps.push_back(sourceFilePath);
|
||||
|
||||
Reference in New Issue
Block a user