[CMake] custom command question

Brad King brad.king at kitware.com
Mon Aug 28 10:41:42 EDT 2006


Doug Henry wrote:
> No, since it is a dependency of a source file that is included in the
> executable I would expect it to be handled (it was in previous
> releases).  It seems that cmake does know about it, because it gives an
> error with the correct path to the file that needs to be generated.  I
> don't know why cmake will not run the custom command anymore.  I suspect
> that the source files I generate this way are created because they are
> in the list as you suggest.

Actually CMake never knew about the dependency.  It was just an artifact
of the way the Makefile generator was implemented that it ever appeared
to work.  In fact it was possible to not work in a parallel build, so we
considered this "feature" of the Makefile generator a bug and fixed it.
 It didn't work in the Visual Studio generators at all.

The only way to get this to work reliably is to add the output of the
custom command as a source file of the target that needs it.  Look at
the end of this FAQ answer:

http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F

-Brad


More information about the CMake mailing list