Board index FlightGear Support Compiling

Question about using CMake

Building FlightGear from source, and in the need for help?

Question about using CMake

Postby chriscalef » Mon Oct 06, 2014 6:57 pm

Okay, sorry for just spamming your forums today, but in my newbishness I had a question about proper use of CMake... If you are participating on an off-and-on basis with a project like FlightGear, and you have git repos that only occasionally get fetched and merged from the head, is it necessary to re-run Cmake every time you update, in case new files have been added?

And if so, do you need to delete your build directories and rebuild everything from scratch each time, or is CMake smart enough to modify the project/solution files in place and leave most of your files in place, only changing what is necessary?

Sorry, been coding for years but still pretty new to CMake. Any insights welcome!

EDIT: OR, does CMake get called automatically from within Visual Studio, as seems to be implied by many messages in the output log?

Thank you for your patience! :-)
Posts: 279
Joined: Wed Feb 20, 2013 9:28 pm

Re: Question about using CMake

Postby Philosopher » Mon Oct 06, 2014 7:37 pm

if you run 'make install' on Linux (basically I suppose what your IDE does ;)), CMake gets run automatically – so if you see any messages in your log about CMake you should be fine ;). Generally it should be a configure-once-and-forget sort of tool.
(inactive but lurking occasionally...)
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Question about using CMake

Postby Hooray » Mon Oct 06, 2014 8:18 pm

This is generally true, cmake will be normally re-run once CMakeLists.txt is updated - however, there are a few exceptions to the rule, especially one related to a FlightGear-specific "hack" to incorporate our version number - but re-running cmake should normally not be a problem, as long as you don't purge the cache, i.e. it will re-read previous values and apply those. I find it rarely necessary to manually invoke cmake unless I am changing my build/configuration settings - for the sake of simplicity, I tend to use multiple build directories for differently-configured SG/FG trees.

Regarding your other question, deleting/re-building should also not be necessary - depending on the underlying make system, only modified files will be updated - even though, that may mean that modified C++ headers trigger a rebuild of almost all of SG/FG - but that's primarily because of the way FG headers are relatively losely structured (i.e. few instances of using the pimpl idiom/forward declarations), and because of the way C++ doesn't support proper dependency resolution (unlike e.g. Ada specs).

If you are concerned about build times, I'd suggest to check out ccache and distcc - even if you should happen to build on/for Windows, you could probably use a mingw/mxe cross-compile to set up a fast build system using a combination of ccache and distcc.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 11977
Joined: Tue Mar 25, 2008 8:40 am

Re: Question about using CMake

Postby chriscalef » Mon Oct 06, 2014 9:19 pm

Cool, thanks for the info! Normally not too concerned about build times, just wondering how the system is supposed to work under normal circumstances.

Good news locally however! I discovered I my FG & SG were stuck on detached heads and had not updated properly, and after getting everything actually caught up to the "next" branches, (and adding one include library to the osg freetype plugin) everything sailed through the compile & build phase without a hitch.

On execution phase, unfortunately, we're crashing in a function relating to navcache, after deleting my navcache files due to sqlite3 unwriteable database error... but I'll save that for the next thread, lol.
Posts: 279
Joined: Wed Feb 20, 2013 9:28 pm

Return to Compiling

Who is online

Users browsing this forum: No registered users and 2 guests