Here are some options:<br><br>1. Manually set your environment variables in Control Panel-&gt;System or your ~./.bashrc or shell configuration file of choice.<br>2. If you need multiple different configurations define them in multiple files which you source into your existing shell.  In Linux you would do something like &quot;. new_settings.sh&quot;.  In Windows I&#39;m guessing you just run a &quot;.bat&quot; file with the settings in it.<br>
3. Use bash, tcsh, etc. functions (Linux only I believe)<br>4. Use CMake to create a script that sets environment variables and invokes a new console (&quot;bash&quot;) or a graphical window (&quot;konsole)<br>5. Use CMake to create a script that you then manually source in via &quot;. new_settings.sh&quot; or running a batch file<br>
<br>I&#39;m sure there are plenty more.  The major problem of course is that CMake is not meant to create persistent environment variables because it&#39;s not meant to launch your build tool of choice, be that Visual Studio, &quot;gnome-terminal&quot;, Kdevelop, eclipse, etc.<br>
<br><div class="gmail_quote">On Sun, Mar 29, 2009 at 4:15 PM, James Bigler <span dir="ltr">&lt;<a href="mailto:jamesbigler@gmail.com">jamesbigler@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#FFFFFF"><div>Sorry about the typo.</div><div><br></div><div>In order to have the environment variable persist you need to set it in the parent process. I know if no mechanism of setting environment variables in a parent process using CMake or otherwise. </div>
<div><br></div><div>The script mechanism I described was intended to set the environment before calling the command you need. In essense the CMake script becomes the parent process from which all child processes will inherit environment variables from. <br>
<font color="#888888"><br><div>James</div></font></div><div><div></div><div class="h5"><div><br>On Mar 29, 2009, at 10:33 AM, Carlson Daniel &lt;<a href="mailto:daniel.c.carlson@gmail.com" target="_blank">daniel.c.carlson@gmail.com</a>&gt; wrote:<br>
<br></div><div></div><blockquote type="cite"><div>I just tested to run a cmake script with the -P option and the environment variable is still cleared when the script terminates... <br><br>A nice solution to my problem would be to simply extend the set-command with an option like:<br>

<br>set(ENV_KEEP{VAR} some_info)<br><br>which means that the environment variable VAR will be set to &#39;some_info&#39; and will NOT will be cleared when the script is terminated. What do you think about this? would this be possible?<br>

<br>//Daniel<br><br><div class="gmail_quote">2009/3/29 Carlson Daniel <span dir="ltr">&lt;<a href="mailto:daniel.c.carlson@gmail.com" target="_blank"></a><a href="mailto:daniel.c.carlson@gmail.com" target="_blank">daniel.c.carlson@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks, but I do not think this is what I want. set($ENV{VAR} &quot;some_data&quot;) in a cmake-script will set an enviroment variable AND delete it when the script terminates. Is this not true when using -P? Do I actually need an execute_process-command (or anything else) in my script that will set the environment variable?<br>


<br><br><div class="gmail_quote">2009/3/29 Philip Lowman <span dir="ltr">&lt;<a href="mailto:philip@yhbt.com" target="_blank"></a><a href="mailto:philip@yhbt.com" target="_blank">philip@yhbt.com</a>&gt;</span><div><div></div>
<div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="gmail_quote"><div>On Sun, Mar 29, 2009 at 9:04 AM, Carlson Daniel <span dir="ltr">&lt;<a href="mailto:daniel.c.carlson@gmail.com" target="_blank"></a><a href="mailto:daniel.c.carlson@gmail.com" target="_blank">daniel.c.carlson@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello and sorry for my late response!<br><br>I can not get this to work. When i execute the command COMMAND ${CMAKE_COMMAND} -E ${template.cmake}<br> 
 I get an error saying something like:</blockquote></div><div><br>I believe there was a minor typo in the post.  The flag you probably want is &quot;-P&quot; which is &quot;process script mode&quot;.<br><br><a href="http://www.cmake.org/cmake/help/cmake2.6docs.html#section_Usage" target="_blank"></a><a href="http://www.cmake.org/cmake/help/cmake2.6docs.html#section_Usage" target="_blank">http://www.cmake.org/cmake/help/cmake2.6docs.html#section_Usage</a><br>



<br></div></div>-- <br><font color="#888888">Philip Lowman<br>
</font></blockquote></div></div></div><br>
</blockquote></div><br>
</div></blockquote></div></div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><br>-- <br>Philip Lowman<br>