[Cmake] ADD_CUSTOM_COMMAND and PRE_BUILD

Amit Ramesh amit.ramesh at cshs.org
Tue Jan 3 18:31:04 EST 2006


     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.

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


More information about the CMake mailing list