<div class="gmail_quote">On Thu, May 24, 2012 at 10:08 AM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 05/24/2012 12:22 PM, Justin Holewinski wrote:<br>
> I narrowed the problem down to Clang not having Platform/Windows-Clang-{C,CXX}.cmake files.<br>
<br>
</div>There is an issue tracker entry for this:<br>
<br>
<a href="http://www.cmake.org/Bug/view.php?id=13035" target="_blank">http://www.cmake.org/Bug/view.php?id=13035</a><br>
<br>
but it is in the backlog waiting for more feedback and a volunteer.<br>
The main problem is distinguishing the GNU-compatible and MS-compatible<br>
builds of Clang.<br></blockquote><div><br></div><div>Oops, missed that issue. Sorry about that!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> If I add the following two files then everything starts to work as expected:<br>
><br>
> Platform/Windows-Clang-C.cmake:<br>
><br>
> if(MINGW)<br>
> include(Platform/Windows-GNU)<br>
> __windows_compiler_gnu(C)<br>
> else()<br>
> # Chain to generic Windows configuration<br>
> include(Platform/Windows)<br>
> endif()<br>
><br>
> Platform/Windows-Clang-CXX.cmake:<br>
><br>
> if(MINGW)<br>
> include(Platform/Windows-GNU)<br>
> __windows_compiler_gnu(C)<br>
> else()<br>
> # Chain to generic Windows configuration<br>
> include(Platform/Windows)<br>
> endif()<br>
><br>
> This way, using Clang with MinGW will force GNU-style platform<br>
> options instead of VS-style Windows options.<br>
> Is this more or less the "right way" to fix this in CMake?<br>
<br>
</div>Interesting approach. That may be better than separating the<br>
compiler id as mentioned in the above-linked issue. The "MINGW"<br>
value is set based on CMAKE_C_PLATFORM_ID which is computed in<br>
the same way and at the same time as CMAKE_C_COMPILER_ID. Try:<br>
<br>
$ cat Platform/Windows-Clang-C.cmake<br>
if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")<br>
include(Platform/Windows-GNU-C)<br>
else()<br>
include(Platform/Windows-cl)<br>
endif()<br>
<br>
$ cat Platform/Windows-Clang-CXX.cmake<br>
if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")<br>
include(Platform/Windows-GNU-CXX)<br>
else()<br>
include(Platform/Windows-cl)<br>
endif()<br>
<br>
Do you have both the MS-style and GNU-style Clang available<br>
to test?<br></blockquote><div><br></div><div>This works for the MinGW build. I really can't say if this fixes the library naming issue for the MS-style Clang. Clang does not have a VC-compatible driver (that I know of) so does not accept VC-style arguments like "/O2", which causes CMake to fail early on in the configure process when using the NMake generator. Clang with MinGW is the only really supported configuration at this point.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
-Brad<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>