[Cmake] ADD_CUSTOM_COMMAND and PRE_BUILD

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


At 06:31 PM 1/3/2006, Amit Ramesh wrote:

>    Well, currently what I want to achieve using pre_build is just a  
>temporary hack in our project. We currently do not have a particular  
>function implemented for unix and mac, and want a dummy  
>implementation to allow compilation. Since our project is cross- platform and I don't intend make temporary changes / hacks in the  
>original source file, I call a script in the pre_build step to  
>replace the original function implementation with a dummy stub. This  
>works fine on the mac, but of course ends up doing the wrong thing in  
>unix.
>
>    Though the current need is not as crucial, I do see some  
>pre_build scripts in the future, and was wondering if it could be  
>supported in CMake under all platforms.

For this case, you could generate the files at CMake time instead of make time.
I really don't think it is possible to have pre-build rules with make.
Working with parallel is a must.



>Thanks
>Amit
>
>
>On Jan 3, 2006, at 2:58 PM, William A. Hoffman wrote:
>
>>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
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list