summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-09-18 16:22:11 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-09-19 11:23:00 (GMT)
commit9d2ac86f45e6f05e8873a0cb3e5e61545fb7c8a7 (patch)
tree1e45d03ae0d3cfd3492af80fd0069259bd932409 /Source/cmLocalGenerator.cxx
parent1423507a71199fd76b457ad9b215a6caca70ee58 (diff)
downloadCMake-9d2ac86f45e6f05e8873a0cb3e5e61545fb7c8a7.zip
CMake-9d2ac86f45e6f05e8873a0cb3e5e61545fb7c8a7.tar.gz
CMake-9d2ac86f45e6f05e8873a0cb3e5e61545fb7c8a7.tar.bz2
Precompile Headers: Add precompile header file to source list
The precompile header file will be added to the list of files, and be part of the newly "Precompile Header File" source group. Also make sure the sources have the header as dependency.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index afcd69f..521677a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2375,6 +2375,14 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
}
+ // Add pchHeader to source files, which will
+ // be grouped as "Precompile Header File"
+ auto pchHeader_sf = this->Makefile->GetOrCreateSource(
+ pchHeader, false, cmSourceFileLocationKind::Known);
+ std::string err;
+ pchHeader_sf->ResolveFullPath(&err);
+ target->AddSource(pchHeader);
+
for (auto& str : { std::ref(useOptionList), std::ref(createOptionList) }) {
cmSystemTools::ReplaceString(str, "<PCH_HEADER>", pchHeader);
cmSystemTools::ReplaceString(str, "<PCH_FILE>", pchFile);
@@ -2399,7 +2407,8 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
}
if (!this->GetGlobalGenerator()->IsXcode()) {
- sf->SetProperty("OBJECT_DEPENDS", pchFile.c_str());
+ sf->AppendProperty("OBJECT_DEPENDS", pchFile.c_str());
+ sf->AppendProperty("OBJECT_DEPENDS", pchHeader.c_str());
sf->SetProperty("COMPILE_OPTIONS", useOptionList.c_str());
}
}