On Win64, in a 32-bit calling environment, there are two environment variables with values like this:<div><div>PROCESSOR_ARCHITECTURE=x86</div><div>PROCESSOR_ARCHITEW6432=AMD64</div><div><br></div>In a pure 64-bit calling environment, there is just:</div>
<div>PROCESSOR_ARCHITECTURE=AMD64</div><div>(and no value for PROCESSOR_ARCHITEW6432)</div><div><br></div><div>...so: you could do something like this (although it may not be 100% foolproof...):</div><div>if(&quot;$ENV{PROCESSOR_ARCHITEW6432}&quot; STREQUAL &quot;&quot;)</div>
<div>  if(&quot;$ENV{PROCESSOR_ARCHITECTURE}&quot; STREQUAL &quot;x86&quot;)</div><div>    # &quot;pure&quot; 32-bit environment...</div><div>  else()</div><div>    # &quot;pure&quot; 64-bit environment...</div><div>  endif()</div>
<div>else()</div><div>  if(&quot;$ENV{PROCESSOR_ARCHITECTURE}&quot; STREQUAL &quot;x86&quot;)</div><div>    # 32-bit program running with an underlying 64-bit environment available...</div><div>  else()</div><div>    # theoretically impossible case...</div>
<div>  endif()</div><div>endif()</div><div><br></div><div>Of course, it would be better to not have conditionals based on the environment... Why do you need to do this?</div><div><br></div><div><br></div><div>HTH,</div><div>
David</div><div><br></div><div><br><div class="gmail_quote">On Mon, Oct 26, 2009 at 6:46 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="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
All the WIN32 flags say they are valid for WIN64 machines.  Is there no equivalent WIN64 flag to determine if the OS is 32 or 64 bit regardless of the bitness of the build?<br><br>Thanks,<br><font color="#888888">James<br>

</font><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></div>