[CMake] Cmake + Eclipse with a team

Michael Jackson mike.jackson at bluequartz.net
Sun Dec 8 15:05:22 EST 2013


On Dec 8, 2013, at 3:18 AM, David Erickson <daviderickson at cs.stanford.edu> wrote:

> On 12/5/2013 5:40 AM, Michael Jackson wrote:
>> I used to use Eclipse for coding with CMake and the what worked the best for me was the following (This assumes you are on Unix/Linux/OSX).
>> 
>> Start in "Project A". Create a directory "Build". Have CMake generate "Makefiles" using "Build" as the build directory.
>> 
>> Start up Eclipse. Create a new "Existing Makefile" project and during the setup of that project you need to adjust the build command to "make -C ${ProjDirPath}/Build VERBOSE=1" which tells Eclipse to run make but use your already created Build directory with your makefiles.
>> 
>> Then Eclipse will show you the complete "file system" of Project A, VCS works, builds work (inside AND outside of Eclipse). The only downside is you get .project/.cproject in your Project A directory which you can have VCS easily ignore with a few config files. The procedure is described on the CMake wiki here
>> 
>> http://www.cmake.org/Wiki/CMake:Eclipse_UNIX_Tutorial  Look for "Option 2". THere are screen shots to help you through the setup.
>> 
>> 
> 
> Thanks Mike-
> I gave this a go and I can definitely build and see all my source, however Eclipse by default was very confused about where to find the source.  I read on the tutorial that when you run with VERBOSE=1 Eclipse should be capable of picking up all the include directories, however when I browse to Project Properties -> C/C++ General -> Paths and Symbols nothing was showing up, so pretty much everything in my source code was red.  I discovered to get this working you need to go to Project Properties -> C/C++ General -> Preprocessor Includes, and on the Providers tab enable "CDT GCC Build Output Parser" and "CDT GCC Built-in Compiler Settings". Afterward doing a clean/build, and re-index, and everything was resolving as expected.
> 
> Thanks!
> David
 
If you put the VERBOSE=1 then Eclipse will parse the compile lines and automatically find the include directories. So you need to setup the project then try compiling at least once and Eclipse should find everything. I have never had a problem with it finding includes except for OS X Frameworks.

Mike Jackson


More information about the CMake mailing list