Say I have a batch file that looks like this.
set varA=valueA
I want my CMakeLists.txt file to make use of this environment variable with the syntax provided by CMake.
$ENV{varA}
Before that can be done, I need to run the batch script to set that environment variable. So, I run it using execute_process
like so.
execute_process(COMMAND var.bat)
# varA should now be set to the value specified in var.bat.
add_executable($ENV{varA})
This does not work. Running the batch script using execute_process
does not update the environment variable. Is it necessary to run the batch script before invoking CMake or is there something I am missing that makes this work?