mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 22:20:50 -06:00
Merge topic 'xcode-pch' into release-3.23
476c6a8910PCH: Fix Xcode non-pch language exclusionfcf1fcfd0cTests: Ignore all classes in Xcode internal objc warnings Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7166
This commit is contained in:
@@ -2469,12 +2469,12 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
|
||||
"OBJCXX" } };
|
||||
|
||||
bool haveAnyPch = false;
|
||||
std::set<std::string> pchLangSet;
|
||||
if (this->GetGlobalGenerator()->IsXcode()) {
|
||||
for (const std::string& lang : langs) {
|
||||
const std::string pchHeader = target->GetPchHeader(config, lang, "");
|
||||
if (!pchHeader.empty()) {
|
||||
haveAnyPch = true;
|
||||
pchLangSet.emplace(lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2519,9 +2519,11 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
const std::string pchHeader = target->GetPchHeader(config, lang, arch);
|
||||
|
||||
if (pchSource.empty() || pchHeader.empty()) {
|
||||
if (this->GetGlobalGenerator()->IsXcode() && haveAnyPch) {
|
||||
if (this->GetGlobalGenerator()->IsXcode() && !pchLangSet.empty()) {
|
||||
for (auto* sf : sources) {
|
||||
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
|
||||
if (pchLangSet.find(sf->GetLanguage()) == pchLangSet.end()) {
|
||||
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(PchIncludedAllLanguages C CXX)
|
||||
|
||||
if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH)
|
||||
add_definitions(-DHAVE_PCH_SUPPORT)
|
||||
endif()
|
||||
|
||||
add_executable(main
|
||||
main.cpp
|
||||
empty.c
|
||||
pch-included.cpp
|
||||
)
|
||||
|
||||
target_precompile_headers(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/pch.h>)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME main COMMAND main)
|
||||
@@ -30,4 +30,5 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
|
||||
endif()
|
||||
run_test(PchReuseFromObjLib)
|
||||
run_test(PchIncludedAllLanguages)
|
||||
run_test(PchIncludedOneLanguage)
|
||||
run_test(PchLibObjLibExe)
|
||||
|
||||
@@ -165,7 +165,7 @@ function(run_cmake test)
|
||||
"|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:"
|
||||
"|[^\n]*xcodebuild[^\n]*DVTPlugInManager"
|
||||
"|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type"
|
||||
"|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined."
|
||||
"|[^\n]*objc[^\n]*: Class [^\n]* One of the two will be used. Which one is undefined."
|
||||
"|[^\n]*is a member of multiple groups"
|
||||
"|[^\n]*offset in archive not a multiple of 8"
|
||||
"|[^\n]*from Time Machine by path"
|
||||
|
||||
Reference in New Issue
Block a user