On Wed, Dec 3, 2008 at 9:48 PM, Bill Hoffman <span dir="ltr"><<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is already done in CMake 2.6. See Modules/<a href="http://CMakeCCompilerId.c.in" target="_blank">CMakeCCompilerId.c.in</a>, it is even better than the above because it works when cross compiling. It does not use a try-run, but rather a try-compile, and then it looks for strings in the executable that was created.<br>
<br>
Anyway, it is already done, and it sets the following variables:<br>
<br>
CMAKE_C_COMPILER_ID<br>
CMAKE_CXX_COMPILER_ID<br>
CMAKE_Fortran_COMPILER_ID</blockquote><div><br>Thanks for adding this Bill. With the exception of dealing with MinGW or differing versions of MSVC this would seem to be a very good replacement for conditionals like:<br>
<br>IF(CMAKE_COMPILER_IS_GNUCC)<br>
IF(MSVC)<br><br>Is this feature here to stay? The documentation doesn't seem very encouraging. =)<br><ul><li>
<a name="variable:CMAKE_LANG_COMPILER_ID"><b><code>CMAKE_<LANG>_COMPILER_ID</code></b></a>: An internal variable subject to change.<br>
<p>This is used in determining the compiler and is subject to change.
</p></li></ul></div></div>-- <br>Philip Lowman<br>