[CMake] Passing environment variables in Windows

Bill Hoffman bill.hoffman at kitware.com
Wed Jan 14 10:46:44 EST 2009


Mathieu Malaterre wrote:

> 
>      <variable> can be an environment variable such as:
> 
>          set( ENV{PATH} /home/martink )
> 
>        in which case the environment variable will be set.
> 
> 
But if you want it to run at custom command time, you would have to do 
it as a cmake script.  Currently there is not a way to set environment 
variables to be used during the running of custom commands without 
creating a cmake script.

${CMAKE_COMMAND} -E myscript.cmake

myscript.cmake
set( ENV{PATH} /home/mystuff )
execute_process(...)

-Bill


More information about the CMake mailing list