From 218ce158f2d9b25bc5789a28d742736129cdb088 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 14 Jul 2017 10:11:10 -0400 Subject: Features: Fix support for a list of language standard options The change in commit v3.9.0-rc1~174^2~2 (CompileFeatures: Let STD compile options be a list, 2016-10-05) did not change all the places we add the language standard options. Expand the list in the other places. --- Source/cmLocalGenerator.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8e00303..b240c7a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1577,7 +1577,11 @@ void cmLocalGenerator::AddCompilerRequirementFlag( const char* opt = target->Target->GetMakefile()->GetRequiredDefinition(option_flag); - this->AppendFlagEscape(flags, opt); + std::vector optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } return; } @@ -1587,7 +1591,11 @@ void cmLocalGenerator::AddCompilerRequirementFlag( if (const char* opt = target->Target->GetMakefile()->GetDefinition(option_flag)) { - this->AppendFlagEscape(flags, opt); + std::vector optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } return; } } -- cgit v0.12 From fca0546175edf6cae51bbf673fa379899e8c0ea6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 14 Jul 2017 10:09:18 -0400 Subject: cmLocalGenerator: Explain standard flag selection logic in comments --- Source/cmLocalGenerator.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 921be3b..2bd7e4e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1637,8 +1637,10 @@ void cmLocalGenerator::AddCompilerRequirementFlag( return; } - // Greater or equal because the standards are stored in - // backward chronological order. + // If the standard requested is older than the compiler's default + // then we need to use a flag to change it. The comparison is + // 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"; @@ -1649,6 +1651,9 @@ void cmLocalGenerator::AddCompilerRequirementFlag( return; } + // The standard requested is at least as new as the compiler's default, + // and the standard request is not required. Decay to the newest standard + // for which a flag is defined. for (; stdIt < defaultStdIt; ++stdIt) { std::string option_flag = "CMAKE_" + lang + *stdIt + "_" + type + "_COMPILE_OPTION"; -- cgit v0.12 From cef77f06878371cf7615bf4dd3da7cc3ba257878 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 14 Jul 2017 10:13:19 -0400 Subject: Allow language extensions without any standard to use a list of options Fix the logic added by commit a2112257 (Add infrastructure to use language extensions without any standard, 2017-06-29) to support a list of options as has been done since commit v3.9.0-rc1~174^2~2 (CompileFeatures: Let STD compile options be a list, 2016-10-05). --- Source/cmLocalGenerator.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f1bf664..2c5db10 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1563,7 +1563,11 @@ void cmLocalGenerator::AddCompilerRequirementFlag( "CMAKE_" + lang + "_EXTENSION_COMPILE_OPTION"; if (const char* opt = target->Target->GetMakefile()->GetDefinition(option_flag)) { - this->AppendFlagEscape(flags, opt); + std::vector optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } } } return; -- cgit v0.12