summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-29 17:18:33 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-29 17:25:19 (GMT)
commita2112257df2f255d8aa3584af468b7d30ff90e8c (patch)
treea0151222c85085208dadb4d1e66f176f90f0ea64 /Source/cmLocalGenerator.cxx
parent8cd28bb0e54f962ab2b189f1b7196c2b014129a7 (diff)
downloadCMake-a2112257df2f255d8aa3584af468b7d30ff90e8c.zip
CMake-a2112257df2f255d8aa3584af468b7d30ff90e8c.tar.gz
CMake-a2112257df2f255d8aa3584af468b7d30ff90e8c.tar.bz2
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: Norbert Lange <nolange79@gmail.com>
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx10
1 files changed, 10 insertions, 0 deletions
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;
}