Commit 8af334f5 authored by Gregor Jasny's avatar Gregor Jasny Committed by Brad King

Xcode: Derive stdlib from CXX flags

Closes: #18396
parent 6f23321d
......@@ -360,6 +360,15 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
else()
set(id_sdkroot "")
endif()
set(id_clang_cxx_library "")
set(stdlib_regex "(^| )(-stdlib=)([^ ]+)( |$)")
string(REGEX MATCHALL "${stdlib_regex}" all_stdlib_matches "${CMAKE_CXX_FLAGS}")
if(all_stdlib_matches)
list(GET all_stdlib_matches "-1" last_stdlib_match)
if(last_stdlib_match MATCHES "${stdlib_regex}")
set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";")
endif()
endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
......
......@@ -86,6 +86,7 @@
SYMROOT = .;
@id_toolset@
@id_lang_version@
@id_clang_cxx_library@
@id_deployment_target@
@id_sdkroot@
};
......
......@@ -2254,6 +2254,22 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
debugStr = "NO";
}
// extract C++ stdlib
for (auto const& language : languages) {
if (language != "CXX") {
continue;
}
std::string& flags = cflags[language];
auto stdlib =
this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags);
if (stdlib.size() > 8) {
const auto cxxLibrary = stdlib.substr(8);
buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
this->CreateString(cxxLibrary));
}
}
buildSettings->AddAttribute("COMBINE_HIDPI_IMAGES",
this->CreateString("YES"));
buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment