From 6027798a30eae02175ce4ad13e1439f4383b6cd3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 4 Feb 2015 19:14:00 +0100 Subject: [PATCH] Features: Allow setting standard dialect below the default. If the requested standard dialect is older than the default dialect then we must use a flag because we cannot decay to a newer standard. --- Source/cmLocalGenerator.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 81e37f626..400415b62 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2287,7 +2287,21 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, return; } - for ( ; stdIt <= defaultStdIt; ++stdIt) + // Greater or equal because the standards are stored in + // backward chronological order. + if (stdIt >= defaultStdIt) + { + std::string option_flag = + "CMAKE_" + lang + *stdIt + + "_" + type + "_COMPILE_OPTION"; + + const char *opt = + target->GetMakefile()->GetRequiredDefinition(option_flag); + this->AppendFlagEscape(flags, opt); + return; + } + + for ( ; stdIt < defaultStdIt; ++stdIt) { std::string option_flag = "CMAKE_" + lang + *stdIt