diff options
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a2eb1b9..b79eb1d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2266,7 +2266,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) std::vector<cmSourceFile*> sources; target->GetSourceFiles(sources, buildType); - for (const std::string& lang : { "C", "CXX" }) { + for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) { auto langSources = std::count_if(sources.begin(), sources.end(), [lang](cmSourceFile* sf) { return lang == sf->GetLanguage() && @@ -2441,7 +2441,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) std::back_inserter(filtered_sources), [&](cmSourceFile* sf) { return sf->GetLanguage() == lang && !sf->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION") && - !sf->GetPropertyAsBool("GENERATED") && + !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && !sf->GetProperty("COMPILE_OPTIONS") && !sf->GetProperty("COMPILE_DEFINITIONS") && !sf->GetProperty("COMPILE_FLAGS") && @@ -2476,11 +2476,10 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) cmSourceFile* sf = filtered_sources[begin]; // Only in Visual Studio generator we keep the source files - // for explicit processing. For the rest the source files will - // not be included in the project. + // for explicit processing. if (!this->GetGlobalGenerator()->IsMultiConfig() || this->GetGlobalGenerator()->IsXcode()) { - sf->SetProperty("HEADER_FILE_ONLY", "ON"); + target->AddSourceFileToUnityBatch(sf->ResolveFullPath()); } sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str()); @@ -2488,7 +2487,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) file << beforeInclude << "\n"; } - file << "#include \"" << sf->GetFullPath() << "\"\n"; + file << "#include \"" << sf->ResolveFullPath() << "\"\n"; if (afterInclude) { file << afterInclude << "\n"; @@ -3124,6 +3123,14 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( const char* pchExtension = source.GetProperty("PCH_EXTENSION"); if (pchExtension) { customOutputExtension = pchExtension; + + // Make sure that for the CMakeFiles/<target>.dir/cmake_pch.h|xx.c|xx + // source file, we don't end up having + // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/cmake_pch.h|xx.pch + cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)"); + while (var.find(objectName)) { + objectName.erase(var.start(), var.end() - var.start()); + } } // Remove the source extension if it is to be replaced. |