[CMake] Re: Re: call a configure command

Rodolfo Schulz de Lima rodolfo at rodsoft.org
Sat Dec 22 16:41:36 EST 2007


> Note, you don't have to do any of the above with add_custom_command.  In
> principle, you could also do those external builds with execute_process.
> The difference, of course, is execute_process runs at CMake time so that
> solves the issue we discussed before of wx-config from your build of
> wxwidgets not being available at CMake time for the rest of your build.

The advantage of doing it with add_custom command (oops, this sounds 
strange...) is that cmake will keep dependencies, recreating only what is 
needed. For instance, if the commands are:

add_custom_command(OUTPUT Makefile COMMAND ./configure)
add_custom_command(OUTPUT lib.a COMMAND make DEPENDS Makefile)
add_custom_command(OUTPUT ${prefix}/lib.a COMMAND cp lib.a ${prefix}/lib.a 
DEPENDS lib.a)

The whole deal won't get executed always. If I somehow changed the external 
source file, it'll be compiled and installed, *without* the project being 
configured again (by running the first command). That's neat.

Regards,
rod 




More information about the CMake mailing list