[CMake] Maintain source hierarchy in Xcode && Override the default Xcode compiler

Leander Bessa Beernaert leanderbb at gmail.com
Tue Mar 26 05:47:05 EDT 2013


Hi,

I'm currently working on porting a project Mac OS X and need some help with
some things.

1) Is it possible to preserve the source code hierarchy in the generate
project? Having every source listed in a single level doesn't really help.
I've tried setting the property "set_property(GLOBAL PROPERTY USE_FOLDERS
ON)" but to no avail.

2) The application I'm working on works with GCC only and version >= 4.6.
I've installed gcc 4.7 with macports but I'm unable to generate a project
with Xcode. I've tried overriding with the following toochain file.

if( "${CMAKE_GENERATOR}" STREQUAL "Xcode")
    # This works halfway through, until i run into incompatible flags
    set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.gcc.4_7")
else()
    # This one works just fine when using Makefiles
    set(CMAKE_SYSTEM_NAME Darwin)
    set(CMAKE_C_COMPILER   /opt/local/bin/gcc-mp-4.7)
    set(CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.7)
endif()


The first condition uses this hack(
http://hamelot.co.uk/programming/add-custom-compiler-to-xcode/) to
integrate the newer version of GCC in Xcode. However, this leads to some
compiler error since some flags are not supported by it (e.g: '-Wmost'). Is
there anyway I can alter the default Xcode projects used by CMake to test
the compiler?

Kind Regards,

Leander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130326/60bc228c/attachment.htm>


More information about the CMake mailing list