[CMake] custom_command pre_build vs. post_build

Brad King brad.king at kitware.com
Wed Sep 20 12:19:16 EDT 2006


Richard Fuchs wrote:
> I've added some logging around each of our libraries that we build, but
> I'm getting an unexpected result.  I'm using a custom command with the
> cmake -E echo to print a log out before and after a library is built. 
> However, the results are not consistent.  When we have custom targets,
> things work the way I'd expect, but when the target is a library, both
> PRE_BUILD and POST_BUILD options are run at the same time.  I've
> attached cmakelists snips and outputs.

>From the documentation of ADD_CUSTOM_COMMAND:

"Note that the PRE_BUILD option is only supported on Visual Studio 7 or
later.  For all other generators PRE_BUILD will be treated as PRE_LINK. "

Unfortunately pre-build is impossible (or at least very costly at make
time) to implement with Makefiles.  There is no way to say "tell me if
any of these other rules will run and if so then run this rule before
them otherwise don't run anything".

-Brad


More information about the CMake mailing list