[CMake] Setting global make variable from CMake,

Michael Wild themiwi at gmail.com
Mon Feb 21 10:39:28 EST 2011


On 02/21/2011 04:35 PM, Eric Noulard wrote:
> 2011/2/21 Łukasz Tasz <lukasz at tasz.eu>:
>> 2011/2/21 Eric Noulard <eric.noulard at gmail.com>:
>>> What is your use case?
>>
>> In my case I'm making integration with ccache, and distcc, and as you
>> know all of them are tuned only via ENV_VARS.
>> Depending on CMAKE_BUILD_TYPE, compiler version, OS I would like to
>> prepare correct DISTCC_HOSTS variable etc.
> 
> Ok I see.
> 
>> That is why in my mind setting global make variable is a solution, at
>> least my brain wouled generate such a makefile:)
>> Another solution that poped up in my mind is to register this variable
>> before calling compiler/linker,
>> Do you know such a call can be configured?
>> for example:
>> export MYVARIABVLE=test; cd dir; compiler_call
> 
> I don't think there is an easy way to do that from within CMake.
> You would need some way to set env var "before" launching the compile rule
> the only way I see would be to craft a compile script for each case.
> 
> 

You could experiment with the RULE_LAUNCH_COMPILE and RULE_LAUNCH_LINK
properties... However, that would only work for Makefile-based generators.

Michael


More information about the CMake mailing list