On Tue, Sep 14, 2010 at 4:03 AM, Gerhard Stengel <[email protected]>wrote:
> I've experienced the same problem and unfortunately, I think there's no way
> to set them permanently. The reason seems to
> be that cmake invokes subshells for most of the commands, so the change of
> the environment variable only happens in the
> subshell and never reaches the parent.
>
This would be true if he were executing commands to modify the environment.
However, that's not what he said he was doing, at least if I understood him
correctly. Certainly the SET (ENV{FOO} ...) calls in his envsetup.cmake
should work, at least.
When he said
and sometimes a few execute_process calls which store the output into an
> environment variable
>
I was assuming he meant something like
EXECUTE_PROCESS (COMMAND /bin/mycmd OUTPUT_VARIABLE ENV{FOO})
which, I just discovered, does NOT work even though I figured it would.
Johny, if that's what you were trying, replace the above with
EXECUTE_PROCESS (COMMAND /bin/mycmd OUTPUT_VARIABLE tempvar)
SET (ENV{FOO} "${tempvar}")
That does work as it should.
If, as Gerhard suspects, you're doing something like
EXECUTE_PROCESS (COMMAND /my/custom/envprogram)
and expecting envprogram to be able to modify your environment, however,
that won't work for the reasons Gerhard and I said - the command is
executing in a subshell, and by definition a subshell cannot affect the
environment of the parent. (At least on Unix.)
Ceej
aka Chris Hillery
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake