[CMake] Setting environment variables in custom command

Michael Wild themiwi at gmail.com
Mon Dec 12 14:31:01 EST 2011


On 12/12/2011 08:28 PM, Robert Dailey wrote:
> Hi,
> 
> I'm creating a custom target in CMake 2.8.7 RC1 and running it in Visual
> Studio 2008. I set an environment variable called BUILDBIN in the custom
> command but for some reason my scripts that I invoke are not picking up
> that environment variable. Am I doing something wrong? These custom
> commands are starting to get pretty complex and I'm wondering if I
> should pull out the logic into a batch file. What do you guys think?
> 
[snip long code]

Definitely batch file or, preferably CMake script. In CMake scripts,
just assign to the ENV{VAR} variable and use execute_process().


Michael



More information about the CMake mailing list