[CMake] include a Make.rules file?

Brandon J. Van Every bvanevery at gmail.com
Fri Jan 26 02:00:38 EST 2007


Sam Miller wrote:
> I am trying to convert an hand-rolled Makefile build system into CMake.
> The project itself is a subset of a larger project, which uses a
> Make.rules file for various cross compilation rules and install
> directories.  Is there any way to include this Make.rules file into the
> Makefile generated by CMake?
>   

Sounds inadvisable in general.  If you're going to keep an old system, 
or work with an old system, you should decide the division of labor 
between the old and new systems.  For instance, our Chicken Scheme-to-C 
compiler runs an Automake build when we prepare a distribution, so that 
users can use either Automake or CMake.  Of course I would prefer they 
use CMake, but the reality is a lot of people are still interested in 
the legacy build system.  Automake doesn't actually do anything for 
CMake's benefit, it's pretty much independent.  We did have to 
consolidate lotsa files and variable names so that both Automake and 
CMake could run successfully in the same build tree.  We also had to 
watch out for collisions between the 2 systems.  Finally, there's the 
political problem of whether future designs are driven by Automake or 
CMake.  I've put my foot down that they are to be driven by CMake, that 
Automake can't dance around and change a bunch of stuff that breaks 
CMake.  I seem to be winning that political battle.

A project often has underlying components that aren't built with CMake, 
especially in open source development.  You can certainly fire off an 
ordinary hand-crafted Makefile build using an ADD_CUSTOM_COMMAND.  But I 
think CMake should be "the software in charge" or "the overarching 
system."  How much info CMake passes down to a subservient legacy build 
system, is a matter for your design.  It's up to you how fast you want 
to migrate your code, how many stability issues you have to consider, 
how free you are to change the code base, etc.  It took me 1 year to 
fully replicate our legacy Automake build in CMake.  I didn't expect it 
to take so long.  Chicken is a ~75K LOC project, although being a 
compiler, it does have lotsa funky build steps and support issues that 
bely its modest size.


Cheers,
Brandon Van Every



More information about the CMake mailing list