<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have a solution for the problem of creating XCode 3.2.x project on a 10.6 machine that are to target the 10.4u SDK.<div><br></div><div>Here's what I did (thanks to the OGRE and Open Scene Graph projects - which exposed me to this solution). </div><div><br></div><div>WARNING: my solution assumes a 32 bit build, so here goes:</div><div><br></div><div>Here's how: put this right at the top of the CMakeLists.txt - in my case, the very top level one. </div><div><div><br></div><div>if (APPLE)</div><div> # Force gcc <= 4.0 on Mac OS X because 4.2 is not supported prior to Mac OS X 10.5</div><div> include(CMakeForceCompiler)</div><div> CMAKE_FORCE_C_COMPILER(gcc-4.0 GNU)</div><div> CMAKE_FORCE_CXX_COMPILER(g++-4.0 GNU)</div><div> SET(CMAKE_SIZEOF_VOID_P 4)</div><div>endif ()</div><div><br></div><div>set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0")</div></div><div><br></div><div><br></div><div>so, what's it do??</div><div><br></div><div>the FORCE_C_COMPILER stuff is going to ensure that the 4.0 series GCC compiler is picked up, which is really useful when the compiler-test phases of cmake get run. What isn't obvious though is that when this is done, some tests the ptr size are NOT carried out any longer, which impacted our project - so here's the caveat: I'm forcing the CMAKE_SIZEOF_VOID_P to 4, which means the rest of our codebase goes with a 32 bit build. For me, not a problem - for you - good luck :-)</div><div><br></div><div>The CMAKE_XCODE_ATTRIBUTE_GCC_VERSION is *also* required. This forces the GCC_VERSION attribute within the xcode configuration to be 4.0 instead of 4.2 (assuming build platform of 10.6). </div><div><br></div><div>Take note; if you leave the CMAKE_XCODE_ATTRIBUTE_GCC_VERSION out - then the Xcode GCC version will *still be 4.2* - so you need both of these settings in the CMakeLists.txt file.</div><div><br></div><div>If anyone can improve on this - I'd appreciate it, thanks for all your help and good luck with those 10.4u builds from a 10.6.x machine!</div><div><br><div>
<span><img height="42" width="137" id="6bc5598c-1b24-4e37-bc42-68f31811bd77" apple-width="yes" apple-height="yes" src="cid:58E3EEB1-2657-4B10-80B2-D89CE52990F5"></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="font-size: 12px; "><div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br></div><div><span class="Apple-style-span" style="font-family: Consolas; font-size: 14px; ">John Clayton</span></div><div><font class="Apple-style-span" face="Consolas" size="4"><span class="Apple-style-span" style="font-size: 14px; "><br></span></font></div><div><span class="Apple-style-span" style="font-family: Consolas; font-size: 14px; ">---------------------------</span></div><div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">FileWave (Europe) GmbH<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">St. Gallerstrasse 1<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">CH - 9500 Wil<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; "> <o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">Phone: +41 71 914 30 80<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10.5pt; font-family: Consolas; ">Fax: +41 71 914 30 81<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10.5pt; font-family: Consolas; ">Web: <a href="x-msg://102/www.filewave.com" style="color: blue; text-decoration: underline; ">www.filewave.com</a></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" face="Consolas" size="4"><span class="Apple-style-span" style="font-size: 14px; ">Skype: johncclayton</span></font></div></div><div><br></div></span></span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br><div><div>On 03.01.2011, at 14:36, John Clayton wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi All,<div><br></div><div>i'm still having problems getting the CMAKE_XCODE_ATTRIBUTE_GCC_VERSION flag to properly force the compiler version I want to use for my project. </div><div><br></div><div>I'm using XCode 3.2.5, on a Mac 10.6.3 machine - trying to target a Max OS X Tiger 10.4u build. I get compiler errors because the gcc-4.2 compiler is being used in the compiler-test stage of CMake. </div><div><br></div><div>I thought CMAKE_XCODE_ATTRIBUTE_GCC_VERSION could be used to force the compiler setting to 4.0?</div><div><br></div><div>My top level CMakeLists.txt file has this as its first few lines - is this the correct way to use this option? </div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>PROJECT( FileWave )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cmake_minimum_required(VERSION 2.6)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0")</div><div><br></div></div><div>The error I get after running an XCode based generator is: </div><div><div>-- The C compiler identification is GNU</div><div>-- The CXX compiler identification is GNU</div><div>-- Checking whether C compiler has -isysroot</div><div>-- Checking whether C compiler has -isysroot - yes</div><div>-- Checking whether C compiler supports OSX deployment target flag</div><div>-- Checking whether C compiler supports OSX deployment target flag - yes</div><div>-- Check for working C compiler using: Xcode</div><div>-- Check for working C compiler using: Xcode -- broken</div><div>CMake Error at /Users/john/CMake/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):</div><div> The C compiler "/usr/bin/gcc-4.0" is not able to compile a simple test</div><div> program.</div><div><br></div><div> It fails with the following output:</div><div><br></div><div> Change Dir: /Users/john/src/TRUNK/BuildSystem/Xcode/CMakeFiles/CMakeTmp</div><div><br></div><div> </div><div><br></div><div> Run Build Command:/Users/john/CMake/bin/cmakexbuild -project</div><div> CMAKE_TRY_COMPILE.xcodeproj build -target cmTryCompileExec -configuration</div><div> Debug</div><div><br></div><div> </div><div><br></div><div> === BUILD NATIVE TARGET cmTryCompileExec OF PROJECT CMAKE_TRY_COMPILE WITH</div><div> CONFIGURATION Debug ===</div><div><br></div><div> Check dependencies</div><div><br></div><div> GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file testCCompiler.c)</div><div><br></div><div> GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file testCCompiler.c)</div><div><br></div><div> ** BUILD FAILED **</div><div><br></div><div> </div></div><div><br></div><div><br><div>
<span><span><pastedGraphic.tiff></span></span><span class="Apple-style-span" style="font-size: 12px; "><div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br></div><div><span class="Apple-style-span" style="font-family: Consolas; font-size: 14px; ">John Clayton</span></div><div><font class="Apple-style-span" face="Consolas" size="4"><span class="Apple-style-span" style="font-size: 14px; "><br></span></font></div><div><span class="Apple-style-span" style="font-family: Consolas; font-size: 14px; ">---------------------------</span></div><div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">FileWave (Europe) GmbH<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">St. Gallerstrasse 1<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">CH - 9500 Wil<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; "> <o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span lang="EN-US" style="font-size: 10.5pt; font-family: Consolas; ">Phone: +41 71 914 30 80<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10.5pt; font-family: Consolas; ">Fax: +41 71 914 30 81<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><span style="font-size: 10.5pt; font-family: Consolas; ">Web: <a href="x-msg://102/www.filewave.com" style="color: blue; text-decoration: underline; ">www.filewave.com</a></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" face="Consolas" size="4"><span class="Apple-style-span" style="font-size: 14px; ">Skype: johncclayton</span></font></div></div><div><br></div></span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></div></blockquote></div><br></div></body></html>