[CMake] Set environment variable

William A. Hoffman billlist at nycap.rr.com
Wed Jan 25 09:22:54 EST 2006


At 09:16 AM 1/25/2006, Xavier Delannoy wrote:
>On Wed, 25 Jan 2006 09:14:42 -0500
>David Cole <david.cole at kitware.com> wrote:
>
>> Try:
>> 
>> SET(ENV{MYVAR} myvalue)
>> 
>> (with no "$"...) The "$" causes substitution...

Setenv only works as cmake is running.  The test process is separate than
the cmake process.  The only way to use SET(ENV for ADD_TEST is to run
the tests with a ctest -S script and put the SET(ENV in the script.
CMake does not modify the environment of its parent shell.  It only modifies
the current and any children processes.

-Bill



More information about the CMake mailing list