CMP0047: Fix CMAKE_COMPILER_IS_GNU(CC|CXX) in OLD behavior

The implementation of CMP0047 detects the QNX compiler id internally,
then changes it to GNU after the language is fully enabled.  This is too
late to correctly set the old IS_GNU variables, so set them as part of
the policy OLD behavior.

Reported-by: Mike Lattanzio <mlattanzio@blackberry.com>
This commit is contained in:
Brad King 2014-08-07 11:25:36 -04:00
parent 3151024d24
commit 59c3695edd
1 changed files with 8 additions and 0 deletions

View File

@ -804,6 +804,14 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
case cmPolicies::OLD:
// OLD behavior is to convert QCC to GNU.
mf->AddDefinition(compilerIdVar.c_str(), "GNU");
if(lang == "C")
{
mf->AddDefinition("CMAKE_COMPILER_IS_GNUCC", "1");
}
else if(lang == "CXX")
{
mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1");
}
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS: