From 70796ef026e8d10a4e50c8e26472d469a45f7dd5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Aug 2014 11:16:24 -0400 Subject: [PATCH] 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 --- Source/cmGlobalGenerator.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 38ba5d13e..3f948b597 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -844,6 +844,14 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, case cmPolicies::OLD: // OLD behavior is to convert QCC to GNU. mf->AddDefinition(compilerIdVar, "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: