Thank you, it works.<br><br><div class="gmail_quote">On Sun, Nov 1, 2009 at 4:36 PM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></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><div></div><div class="h5"><br>
On 1. Nov, 2009, at 16:27 , elizabeta petreska wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello<br>
<br>
I am using Windows ansd Cmake 2.6. I am invoking CMake from command window<br>
which has set some environment variables. The environment variables are<br>
visible only the during the lifetime of the command window.<br>
I am using the environment variables in many places through my<br>
cmakelists.txt , for example in INCLUDE_DIRECTORIES, LINK_LIBRARIES etc. The<br>
environment variables are mainly set with file path strings.<br>
<br>
Problem :<br>
When I am working in Visual Studio on my project, if my cmakelists.txt for<br>
the project is changed, Cmake is rerun from Visual Studio.<br>
Because Cmake is run from Visual Studio , and not the shell where the<br>
environment variables are set , it can't recognize the environment<br>
variables. How to overcome this ?<br>
Thanks<br>
</blockquote>
<br></div></div>
Somewhere short after the PROJECT command, put something like this:<br>
<br>
foreach(_var VAR1 VAR2 VAR3 VAR4)<br>
if(NOT DEFINED ${_var})<br>
set(${_var} "$ENV{${_var}}" CACHE INTERNAL "This is my super variable ${_var}")<br>
endif()<br>
endforeach()<br>
<br>
This will initialize internal cache variables with the values from the environment, and then in subsequent runs use the values from the cache.<br>
<br>
<br>
HTH<br><font color="#888888">
<br>
Michael<br>
</font></blockquote></div><br>