[CMake] ADD_CUSTOM_COMMAND, 2.2.3 vs. 2.0.6

Brad King brad.king at kitware.com
Thu Jan 26 10:52:36 EST 2006


Egil Brendsdal wrote:
> ADD_CUSTOM_COMMAND in cmake 2.2.3 behaves differently from version 2.0.6;
> Using the latest version, the 'custom target' is not included in the makefile.
> (As an illustration, see the output from Linux 'grep . CMakeLists.txt cmd; sh cmd'
> at the end of the mail.)
> 
> Does anyone know a workaround?

ADD_CUSTOM_COMMAND is to add rules within other top-level targets added 
with ADD_EXECUTABLE, ADD_LIBRARY, ADD_CUSTOM_TARGET, etc.

The fact that it showed up in the makefile in the 2.0 generator was a 
side effect of the implementation.  The 2.2 generator splits the build 
rules for each target into sub-makefiles in order to handle certain 
inter-target dependencies properly.

To get a make target use ADD_CUSTOM_TARGET.  It should work in both 
versions.

-Brad


More information about the CMake mailing list