diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-11-12 13:28:34 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-12 13:28:46 (GMT) |
commit | cba091d3a900d69961ef94a475c3ba1b0cb94453 (patch) | |
tree | 999f1aa4a4eacc885196088f670865c754b7835f /Source | |
parent | 00f5e0206037ceec2d3c33569d1c845fdffa504f (diff) | |
parent | e01935ac9d61e22be49f26910a76769585d7a257 (diff) | |
download | CMake-cba091d3a900d69961ef94a475c3ba1b0cb94453.zip CMake-cba091d3a900d69961ef94a475c3ba1b0cb94453.tar.gz CMake-cba091d3a900d69961ef94a475c3ba1b0cb94453.tar.bz2 |
Merge topic 'pch-no-duplicates' into release-3.16
e01935ac9d PCH: No repeated path for internal generated PCH files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4030
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 10 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f235af9..c3ed9e8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3360,14 +3360,8 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom); } - if (this->GetGlobalGenerator()->IsMultiConfig()) { - filename = cmStrCat( - generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/"); - } else { - // For GCC we need to have the header file .h[xx] - // next to the .h[xx].gch file - filename = generatorTarget->ObjectDirectory; - } + filename = cmStrCat( + generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/"); const std::map<std::string, std::string> languageToExtension = { { "C", ".h" }, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cae47e0..6a9cb23 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3123,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. |