[CMake] CMake CDT generator

Michael Jackson mike.jackson at bluequartz.net
Sat Sep 18 08:25:43 EDT 2010


On Sat, Sep 18, 2010 at 5:34 AM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Saturday 18 September 2010, tinauser at libero.it wrote:
>> Dear list,
>> I'm trying to use CMake to move a project from XCode to Eclipse CDT.
>> I have A CMakeList text that generate a working project in XCode. I tryed
>> to use it for Eclipse, but I have some unexpected result.
>>
>> -I have the soruce folder called src, where the CMakeLists is located.
>> -I run Cmake from a folder called build.
>> -In the CmakeLists I have the following commands:
>> __________________________________________
>> SET ( HEADERS
>>       async.h
>>       bool.h)
>>
>> SET ( SOURCES
>>       buffer.c
>>       buff_manager.c)
>>
>> IF (DARWIN)
>>   SET ( MACOSX_APP MACOSX_BUNDLE )
>> ENDIF (DARWIN)
>>
>> ADD_EXECUTABLE ( eyeseecam ${MACOSX_APP}
>>       ${HEADERS} ${SOURCES}
>> )
>> _____________________________________________
>>
>> -I run ccmake ../ -G"Eclipse CDT4 - Unix Makefiles" , because in the parent
>> folder of build I have another CMakeLists that just set the project name
>> and send to the src folder:
>
> With the eclipse generator you shouldn't use a build directory which is a
> subdirectory of the source directory.
> Eclipse can't handle this properly.
> See here for more details: http://www.paraview.org/Wiki/Eclipse_CDT4_Generator
> Either make your build directory a "sibling" of the source directory (...or
> build in-source).
>
> Alex
>
>
>
>> ___________________________________________
>> CMAKE_MINIMUM_REQUIRED ( VERSION 2.4 )
>> CMAKE_POLICY ( SET CMP0003 NEW )
>> PROJECT(MyProject)
>> if (APPLE)
>>   set(CMAKE_OSX_ARCHITECTURES i386)
>>   #set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
>> endif (APPLE)
>> SUBDIRS(src)
>> _____________________________________________
>>
>> -With the ccmake, I set the CMAKE_BUILD_TYPE as Debug
>> and the [B]CMAKE_ECLIPSE_EXECUTABLE[\B] as
>> [B]/Applications/eclipse/Eclipse. app [\B].
>>
>> Then I Import the .project, however:
>> 1. Source and Headers are not imported
>> 2. I don't have the CDT Builders, but only a CMakeBuilder.
>> Because of this I can run the executable, but I can not modify/debug the
>> code.
>>
>> Am I doing something wrong?
>> Any help is greately appriciated
>>
>> PS
>> I posted this question also on the CDT forum but...in 3 days, no answer(I
>> also reformulated the question).Hope to have more succes here.

Also remember that on the same Wiki page there is the slightly more
unofficial way of using Eclipse by first generating plain makefiles
from CMake then manually creating a new "Makefile" project in Eclipse.
This will give you full access to your projects files and allow a
build folder within your project directory. Been doing it this way for
the last 3 years with Eclipse and CMake.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio


More information about the CMake mailing list