<div>Were you passing custom command-line arguments in the project? Clang only accepts a very limited set of CL-style arguments (AFAIK):</div><div><br></div><div><font face="'courier new', monospace"><div>>c:\projects\llvm-dev\build-3.1\bin\clang clang-test.c -out:clang-test.exe</div>
<div><br></div><div>>c:\projects\llvm-dev\build-3.1\bin\clang clang-test.c -out:clang-test.exe -Zm</div><div>clang: error: unsupported use of internal gcc -Z option '-Zm'</div><div><br></div><div>>c:\projects\llvm-dev\build-3.1\bin\clang clang-test.c -out:clang-test.exe -MT</div>
<div>clang: error: argument to '-MT' is missing (expected 1 value)</div></font></div><div><br></div><div>This is with a Clang built with the compilers from the Windows SDK 7.1.</div><div><br></div><div class="gmail_quote">
On Thu, May 24, 2012 at 2:12 PM, Keith Gardner <span dir="ltr"><<a href="mailto:kgardner@zebraimaging.com" target="_blank">kgardner@zebraimaging.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I have built clang (llvm) on windows with Visual Studio 2010 and used the built binaries as the compiler inside of a Visual Studio project. This was with clang 3.0 and llvm 2.9.1.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>] <b>On Behalf Of </b>Justin Holewinski<br>
<b>Sent:</b> Thursday, May 24, 2012 1:49 PM<br><b>To:</b> Brad King<br><b>Cc:</b> <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br><b>Subject:</b> Re: [CMake] Clang + MinGW Linking Issue<u></u><u></u></span></p>
</div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, May 24, 2012 at 10:08 AM, Brad King <<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>> wrote:<u></u><u></u></p>
<div><p class="MsoNormal" style="margin-bottom:12.0pt">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.<u></u><u></u></p>
</div><p class="MsoNormal">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.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Oops, missed that issue. Sorry about that!<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><div><p class="MsoNormal" style="margin-bottom:12.0pt">
<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?<u></u><u></u></p></div><p class="MsoNormal">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?<u></u><u></u></p></blockquote><div><p class="MsoNormal">
<u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><p class="MsoNormal"><br>Thanks,<br>-Brad<u></u><u></u></p>
</blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">-- <u></u><u></u></p><div><p class="MsoNormal">
Thanks,<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Justin Holewinski<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></blockquote>
</div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>