[CMake] Setting the compiler

Bill Hoffman bill.hoffman at kitware.com
Fri Jul 27 21:05:33 EDT 2007


Juan Sanchez wrote:
>> So, what is the current build system and how does it work?
>>
>>     
>
> Everyone writes their own.  Most of the projects are for a single
> developer.  Typically, they use GNU make.  I've been asked to
> investigate a common build system.  Of course, everyone has their own
> opinion about what a build system should be.
>
>   
Sure, but they must have to set the compiler for the makefile at some 
point either by environment,
PATH, or hard coding in the gnu makefile.   Once run cmake will cache 
all the information needed
to build.  So, the environment is only needed the first time around.
> Of the build systems I've investigated, CMake is the most attractive.
> Except for the index, I think that the book you've written is excellent.
>
> The only thing I'd really like clarification on is:
>
> Would changing the compiler (64bit to 32bit) using environment variables
> trigger massive recompilation (dependency hell) when changing the
> setting back from (32bit to 64bit)?  Note that 32bit and 64bit would
> have separate build directories.
>   
If they are in separate build directories they would not affect each 
other at all.  cd 32bit; make
cd 64bit; make.
> Is the dependency checking that cmake uses as effective as "g++ -M"
> (CPP)  in determining the dependencies?  Are the "#include" statements
> in conditional macros tests honored when determining the dependencies?
> Are the macro defines used in the compilation also passed along to the
> dependency checker for each build variant?
>   
No, they are not.  CMake will potentially have extra depends that are 
not actually being used
for the build.  However, cmake's scanner is fast, and it is better to 
have extra depends than
not enough.   Having a full CPP could be done, but in practice it really 
has not caused problems
even for very large software systems.

-Bill



More information about the CMake mailing list