[CMake] Regarding enviroment variables directly used in executables

David Cole dlrdave at aol.com
Thu Aug 14 09:32:19 EDT 2014


A "SET(ENV{TARGET2_EXE_PATH} "C:/Test/Target2")" call in a CMakeLists 
file only has an effect while CMake is running.

If you need the env var set for your batch file to run, you should pass 
the value for it down in as an arg to the batch file, and then do:

    set TARGET2_EXE_PATH=%~1

(no quotes in the batch file set, %~1 means arg 1 to the batch file, 
but with any surrounding quotes stripped...)


HTH,
David



More information about the CMake mailing list