[CMake] Pass GNU flags on Windows

Daniel Dilts diltsman at gmail.com
Tue Feb 10 14:52:47 EST 2015


I am attempting to run CMake and use clang for the compiler.  I am on
Windows 8.1.  It seems to me that if CMake used gcc flags instead of vc++
flags that this would work.  Any ideas how I can make this work?

I use the following command:

cmake -DCMAKE_C_COMPILER=clang.exe DCMAKE_CXX_COMPILER=clang++.exe
-DCMAKE_RC_COMPILER=rc.exe -G
"Ninja" ../llvm

When it attempts to test the compiler I get the following results:

  Run Build Command:"d:/llvm/ninja/ninja.exe" "cmTryCompileExec2377752233"
  [1/2] Building C object
  CMakeFiles\cmTryCompileExec2377752233.dir\testCCompiler.c.obj
  FAILED: d:\llvm\build\Release\bin\clang.exe /nologo /DWIN32 /D_WINDOWS /W3
  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /showIncludes
  /FoCMakeFiles\cmTryCompileExec2377752233.dir\testCCompiler.c.obj
  /FdCMakeFiles\cmTryCompileExec2377752233.dir\ -c testCCompiler.c
  clang.exe: error: no such file or directory: '/nologo'
  clang.exe: error: no such file or directory: '/DWIN32'
  clang.exe: error: no such file or directory: '/D_WINDOWS'
  clang.exe: error: no such file or directory: '/W3'
  clang.exe: error: no such file or directory: '/D_DEBUG'
  clang.exe: error: no such file or directory: '/MDd'
  clang.exe: error: no such file or directory: '/Zi'
  clang.exe: error: no such file or directory: '/Ob0'
  clang.exe: error: no such file or directory: '/Od'
  clang.exe: error: no such file or directory: '/RTC1'
  clang.exe: error: no such file or directory: '/showIncludes'
  clang.exe: error: no such file or directory:
  '/FoCMakeFiles\cmTryCompileExec2377752233.dir\testCCompiler.c.obj'
  clang.exe: error: no such file or directory:
  '/FdCMakeFiles\cmTryCompileExec2377752233.dir\'
  ninja: build stopped: subcommand failed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150210/a0e6dd35/attachment.html>


More information about the CMake mailing list