Can you provide the relationship between these two snippets of code? Is the Python script doing the os.environ setting launching CMake somehow? Can you share that?
For 2 snippet code I wanted trial to send a message from Python to CMake parents , when it call to Python I trial to export an env variable by Python to use in CMake for other purpose. I used with excute_process to call Python script in CMake parents and message to print value Python return back . But it was not work
A child process cannot set the environment of the parent process, so a Python script setting its environment has no effect on the CMake process calling it via execute_process.
Are there anyway Python scripts can export env for other scripts use or it just only set its env and other scripts can’t see ? I used to set env variable in CMake and shell. Python scripts use env (export env in shell and set env $ENV{env} in CMake) . I just trial some way to export env variables from Python.
The environment can only be modified for the currently running processes and new processes started (via passing them to the execve or CreateProcess family of APIs).