diff options
author | Brad King <brad.king@kitware.com> | 2017-07-17 14:25:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-07-17 14:25:36 (GMT) |
commit | 3ce57e3b546cb1f7aec43717ff239cd72428cc5a (patch) | |
tree | 058467681de172ee741c001afaaa17b3ab113e15 /Source | |
parent | 96041907014c9d1f83dc6b2c7fbbdab8aed728ea (diff) | |
parent | cef77f06878371cf7615bf4dd3da7cc3ba257878 (diff) | |
download | CMake-3ce57e3b546cb1f7aec43717ff239cd72428cc5a.zip CMake-3ce57e3b546cb1f7aec43717ff239cd72428cc5a.tar.gz CMake-3ce57e3b546cb1f7aec43717ff239cd72428cc5a.tar.bz2 |
Merge topic 'fix-lang-std-option-list'
cef77f06 Allow language extensions without any standard to use a list of options
74e33711 Merge branch 'backport-fix-lang-std-option-list' into fix-lang-std-option-list
fca05461 cmLocalGenerator: Explain standard flag selection logic in comments
218ce158 Features: Fix support for a list of language standard options
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1059
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 921be3b..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<std::string> optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } } } return; @@ -1637,25 +1641,38 @@ 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"; const char* opt = target->Target->GetMakefile()->GetRequiredDefinition(option_flag); - this->AppendFlagEscape(flags, opt); + std::vector<std::string> optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } 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"; if (const char* opt = target->Target->GetMakefile()->GetDefinition(option_flag)) { - this->AppendFlagEscape(flags, opt); + std::vector<std::string> optVec; + cmSystemTools::ExpandListArgument(opt, optVec); + for (size_t i = 0; i < optVec.size(); ++i) { + this->AppendFlagEscape(flags, optVec[i]); + } return; } } |