An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 6a818b69 authored by Cristian Adam's avatar Cristian Adam 💬 Committed by Brad King
Browse files

ObjC: Proper initialization of ObjC/XX standard properties

Fix logic added by commit 81566557 (ObjC: Initialize ObjC/XX standard
properties from C/C++ counterparts, 2019-11-09) to account for cases
when the CXX standard is not explicitly set.  Also, do not copy the
`*_STANDARD_REQUIRED` and `*_EXTENSIONS` properties unless we copied the
`*_STANDARD` property.
parent 84260534
Pipeline #151416 passed with stage
......@@ -714,23 +714,38 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
// Now that C/C++ _STANDARD values have been computed
// set the values to ObjC/ObjCXX _STANDARD variables
if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
auto copyStandardToObjLang = [&](LanguagePair const& lang) -> bool {
if (!target->GetProperty(cmStrCat(lang.first, "_STANDARD"))) {
auto* standard =
target->GetProperty(cmStrCat(lang.second, "_STANDARD"));
if (!standard) {
standard = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang.second, "_STANDARD_DEFAULT"));
target->Target->SetProperty(cmStrCat(lang.first, "_STANDARD"),
return true;
return false;
auto copyPropertyToObjLang = [&](LanguagePair const& lang,
const char* property) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (!target->GetProperty(cmStrCat(lang.first, property))) {
if (!target->GetProperty(cmStrCat(lang.first, property)) &&
target->GetProperty(cmStrCat(lang.second, property))) {
cmStrCat(lang.first, property),
target->GetProperty(cmStrCat(lang.second, property)));
for (auto const& lang : objcEnabledLanguages) {
copyPropertyToObjLang(lang, "_STANDARD");
if (copyStandardToObjLang(lang)) {
copyPropertyToObjLang(lang, "_STANDARD_REQUIRED");
copyPropertyToObjLang(lang, "_EXTENSIONS");
return true;
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