mirror of
https://github.com/reactos/CMake.git
synced 2024-12-12 13:56:00 +00:00
Merge topic 'fix-lang-std-option-list'
cef77f06
Allow language extensions without any standard to use a list of options74e33711
Merge branch 'backport-fix-lang-std-option-list' into fix-lang-std-option-listfca05461
cmLocalGenerator: Explain standard flag selection logic in comments218ce158
Features: Fix support for a list of language standard options Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1059
This commit is contained in:
commit
3ce57e3b54
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user