diff options
author | Brad King <brad.king@kitware.com> | 2019-09-20 14:27:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-09-20 14:29:16 (GMT) |
commit | df0586d8d5c99d870369f1f60f63431deb98a6ba (patch) | |
tree | ef53c53c56ef1ca352c7230ee11f407fc5a6f8e4 /Source | |
parent | cd607ef5606cef0ffac822afe1dafa2615a5554d (diff) | |
parent | 9d2ac86f45e6f05e8873a0cb3e5e61545fb7c8a7 (diff) | |
download | CMake-df0586d8d5c99d870369f1f60f63431deb98a6ba.zip CMake-df0586d8d5c99d870369f1f60f63431deb98a6ba.tar.gz CMake-df0586d8d5c99d870369f1f60f63431deb98a6ba.tar.bz2 |
Merge topic 'pch-source-list'
9d2ac86f45 Precompile Headers: Add precompile header file to source list
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3832
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Source/cmSourceFile.h | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d7c0611..31e2dc0 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2391,6 +2391,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); @@ -2415,7 +2423,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()); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1938c23..e6bb25c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -104,6 +104,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, this->AddSourceGroup("", "^.*$"); this->AddSourceGroup("Source Files", CM_SOURCE_REGEX); this->AddSourceGroup("Header Files", CM_HEADER_REGEX); + this->AddSourceGroup("Precompile Header File", CM_PCH_REGEX); this->AddSourceGroup("CMake Rules", "\\.rule$"); this->AddSourceGroup("Resources", CM_RESOURCE_REGEX); this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index dd36d45..ff465c7 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -135,6 +135,8 @@ private: "hpj" \ "|bat)$" +#define CM_PCH_REGEX "cmake_pch\\.(h|hxx)$" + #define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$" #endif |