diff options
author | Brad King <brad.king@kitware.com> | 2019-11-05 16:24:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-05 16:24:55 (GMT) |
commit | 13ea5f06fad9bd9645cf4fb768e476dd7a053dd1 (patch) | |
tree | 96cc54679a2d0cca30793b66d9f5a16499638fd2 /Source/cmGeneratorTarget.cxx | |
parent | 3521e3d524447f0f3ac20f8e2df2435dd6de7aa2 (diff) | |
parent | e331367a898c6e0afa386c52fc7bd4d84d75ec29 (diff) | |
download | CMake-13ea5f06fad9bd9645cf4fb768e476dd7a053dd1.zip CMake-13ea5f06fad9bd9645cf4fb768e476dd7a053dd1.tar.gz CMake-13ea5f06fad9bd9645cf4fb768e476dd7a053dd1.tar.bz2 |
Merge topic 'objc-pch'
e331367a89 PCH: Add support for OBJC/OBJCXX languages
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3983
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d5e58b0..41f1df9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3347,9 +3347,11 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders( std::string cmGeneratorTarget::GetPchHeader(const std::string& config, const std::string& language) const { - if (language != "C" && language != "CXX") { + if (language != "C" && language != "CXX" && language != "OBJC" && + language != "OBJCXX") { return std::string(); } + if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) { return std::string(); } @@ -3380,8 +3382,15 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, filename = generatorTarget->ObjectDirectory; } + const std::map<std::string, std::string> languageToExtension = { + { "C", ".h" }, + { "CXX", ".hxx" }, + { "OBJC", ".objc.h" }, + { "OBJCXX", ".objcxx.hxx" } + }; + filename = cmStrCat(filename, "CMakeFiles/", generatorTarget->GetName(), - ".dir/cmake_pch", ((language == "C") ? ".h" : ".hxx")); + ".dir/cmake_pch", languageToExtension.at(language)); const std::string filename_tmp = cmStrCat(filename, ".tmp"); if (!pchReuseFrom) { @@ -3431,7 +3440,8 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, std::string cmGeneratorTarget::GetPchSource(const std::string& config, const std::string& language) const { - if (language != "C" && language != "CXX") { + if (language != "C" && language != "CXX" && language != "OBJC" && + language != "OBJCXX") { return std::string(); } const auto inserted = @@ -3457,9 +3467,20 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config, // For GCC the source extension will be tranformed into .h[xx].gch if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) { - filename += ((language == "C") ? ".h.c" : ".hxx.cxx"); + const std::map<std::string, std::string> languageToExtension = { + { "C", ".h.c" }, + { "CXX", ".hxx.cxx" }, + { "OBJC", ".objc.h.m" }, + { "OBJCXX", ".objcxx.hxx.mm" } + }; + + filename += languageToExtension.at(language); } else { - filename += ((language == "C") ? ".c" : ".cxx"); + const std::map<std::string, std::string> languageToExtension = { + { "C", ".c" }, { "CXX", ".cxx" }, { "OBJC", ".m" }, { "OBJCXX", ".mm" } + }; + + filename += languageToExtension.at(language); } const std::string filename_tmp = cmStrCat(filename, ".tmp"); @@ -3477,7 +3498,8 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config, std::string cmGeneratorTarget::GetPchFileObject(const std::string& config, const std::string& language) { - if (language != "C" && language != "CXX") { + if (language != "C" && language != "CXX" && language != "OBJC" && + language != "OBJCXX") { return std::string(); } const auto inserted = |