Commit a2112257 authored by Brad King's avatar Brad King 💬
Browse files

Add infrastructure to use language extensions without any standard

When `<LANG>_STANDARD` is not set we will not add any language standard
flags.  If `<LANG>_EXTENSIONS` is not OFF then our default is supposed
to be ON.  In order to support compilers that do not enable their
extensions by default, check a `CMAKE_<LANG>_EXTENSION_COMPILE_OPTION`
variable for an extensions flag to use without any language standard.

Suggested-by: nolange's avatarNorbert Lange <>
parent 8cd28bb0
......@@ -1498,6 +1498,16 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
std::string stdProp = lang + "_STANDARD";
const char* standardProp = target->GetProperty(stdProp);
if (!standardProp) {
if (ext) {
// No language standard is specified and extensions are not disabled.
// Check if this compiler needs a flag to enable extensions.
std::string const option_flag =
if (const char* opt =
target->Target->GetMakefile()->GetDefinition(option_flag)) {
this->AppendFlagEscape(flags, opt);
Supports Markdown
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