[CMake] cdt4 generator and adding new source files from inside eclipse

Alexander Neundorf a.neundorf-work at gmx.net
Thu Oct 27 15:31:02 EDT 2011


On Wednesday 26 October 2011, Dan Kegel wrote:
> I'm going over the checklist of whether cmake will meet
> the needs of my eclipse users, and their first question
> was what was the workflow for adding a new source
> file.
> 
> I just tried the experiment of adding a .cpp file,
> adding it to CMakeLists.txt, and clicking Build...
> and the .o file showed up as it should have.  This
> kind of surprised me, since I didn't re-run cmake.
> 
> Is the generator smart enough to notice the
> changes to the CMake files and re-run cmake
> with the same environment variables and options
> as it was originally run with?  I kind of doubt it.

Yes, the generated makefiles have complete dependencies, including those to 
rerun cmake if any of the CMakeLists.txt have changed.
 
> The cdt4 web page says
> "When you edit your CMakeLists.txt file, you are recommended to delete
> your project and reimport it."
> Is it assuming that you've rerun cmake manually?

No.

Eclipse has a "Refresh" entry in the context menu of the project view, which 
kind of refreshes what it knows about the project.
But somehow it sometimes doesn't seem to really update what it knows about the 
project from the .project/.cproject files on disk.
Some things are updated, but some thing it seems are not.
I didn't yet figure out exactly what's going on.
If you find out, I think it would be a good idea to file a bug at the eclipse 
and/or cdt project, so that they really update their view of the project from 
the files on disk on refresh.

Alex


More information about the CMake mailing list