<div class="gmail_quote">On Tue, Sep 14, 2010 at 4:03 AM, Gerhard Stengel <span dir="ltr"><<a href="mailto:gerhards2@ast.dfs.de">gerhards2@ast.dfs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I've experienced the same problem and unfortunately, I think there's no way to set them permanently. The reason seems to<br>
be that cmake invokes subshells for most of the commands, so the change of the environment variable only happens in the<br>
subshell and never reaches the parent.<br></blockquote></div><br>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.<br>
<br>When he said<br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">and sometimes a few execute_process calls which store the output into an environment variable<br>
</blockquote><div><br>I was assuming he meant something like<br><br> EXECUTE_PROCESS (COMMAND /bin/mycmd OUTPUT_VARIABLE ENV{FOO})<br><br>which, I just discovered, does NOT work even though I figured it would.<br><br>Johny, if that's what you were trying, replace the above with<br>
<br> EXECUTE_PROCESS (COMMAND /bin/mycmd OUTPUT_VARIABLE tempvar)<br> SET (ENV{FOO} "${tempvar}")<br><br>That does work as it should.<br><br>If, as Gerhard suspects, you're doing something like<br><br> EXECUTE_PROCESS (COMMAND /my/custom/envprogram)<br>
<br>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.)<br>
<br>Ceej<br>aka Chris Hillery<br></div>