[Cmake] ADD_CUSTOM_COMMAND and PRE_BUILD

William A. Hoffman billlist at nycap.rr.com
Tue Jan 3 17:58:08 EST 2006


At 05:45 PM 1/3/2006, Amit Ramesh wrote:

>Hi,
>
>    I am currently in a situation where I need a pre_build step under Linux. I see that CMake does not handle pre_build in the case of Makefiles, and the last posting I see on this topic (posted Apr 2004, appended below) says that it may not be possible to implement pre_build in Makefiles. Couldn't the following strategy be used to achieve it though?
>
>    If x is a pre_build condition for y, then I agree that the following will end up as a pre_link:
>
>    y: x
>       generate y
>
>    However, if one ensures that x occurs before y in an initial build rule, like:
>
>    all: x y
>
>    x: 
>       generate x
>
>    y: z w
>       generate y
>
>    Then x will get done before y or its dependencies (assuming no parallel builds). 
>
>    I agree that if one invokes 'make y' instead of 'make' or 'make all', then x will not get done. So this is only a partial/incomplete solution to the problem. However, it would still be better than not having any support for pre_build.
>
>    Let me know. 


I don't think we can assume no parallel builds.   Perhaps there is another way to do
what you want?  Exactly what are you trying to do?

-Bill



More information about the CMake mailing list