From a2112257df2f255d8aa3584af468b7d30ff90e8c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 29 Jun 2017 13:18:33 -0400 Subject: Add infrastructure to use language extensions without any standard When `_STANDARD` is not set we will not add any language standard flags. If `_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__EXTENSION_COMPILE_OPTION` variable for an extensions flag to use without any language standard. Suggested-by: Norbert Lange --- Source/cmLocalGenerator.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 54e76b2..28ed325 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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 = + "CMAKE_" + lang + "_EXTENSION_COMPILE_OPTION"; + if (const char* opt = + target->Target->GetMakefile()->GetDefinition(option_flag)) { + this->AppendFlagEscape(flags, opt); + } + } return; } -- cgit v0.12