Building c++ project on Windows with CMake, Clang and Ninja

后端 未结 2 1840
终归单人心
终归单人心 2020-12-09 10:39

I currently have cmake, clang and ninja installed on windows. I am trying to use CMake to generate a ninja build file to compile a very simple hello world program.

M

2条回答
  •  时光说笑
    2020-12-09 11:23

    Don't know if it can be helpful but I had the same error. Now I can compile with clang(3.7.1)/ninja(1.6)/cmake(3.4.1) on Windows performing the following actions in a build directory:

    1. load the relevant vcvarsXX.bat file (e.g. "\VC\vcvarsall.bat" x86)
    2. set both CC and CXX to clang-cl (instead of clang and clang++)
    3. run cmake -G Ninja
    4. run cmake --build .

提交回复
热议问题