[CMake] set environment variable scope

Kaleb Pederson kaleb.pederson at gmail.com
Fri Mar 28 18:08:03 EDT 2008


What's the best way to set an environment variable that will be active for a 
custom target or command?

For example:

SET(ENV{TESTING} "MyValueHere")
MESSAGE(STATUS "Set value to: $ENV{TESTING}")
ADD_CUSTOM_TARGET(
        target
        COMMAND cmdThatRequiresTestingEnvVar
        VERBATIM
        )

Thanks for the help.

--Kaleb


More information about the CMake mailing list