Windows上的Clang和CMake [英] Clang and CMake on Windows
本文介绍了Windows上的Clang和CMake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Windows上使用Clang 3.8和CMake 3.7构建C ++项目,但是Clang在 configure 中会发出错误,如下所示。
I am building a C++ project with Clang 3.8 and CMake 3.7 on Windows, but Clang emits an error in configure like below.
Determining if the CXX compiler works failed with the following output:
Change Dir: C:/tools/k.build/CMakeFiles/CMakeTmp
Run Build Command:"C:/tools/ninja.exe" "cmTC_c0004"
[1/2] Building CXX object CMakeFiles/cmTC_c0004.dir/testCXXCompiler.cxx.obj
[2/2] Linking CXX executable cmTC_c0004.exe
FAILED: cmTC_c0004.exe
cmd.exe /C "cd . && C:\tools\llvm-3.8.1.build\Release\bin\clang++.exe CMakeFiles/cmTC_c0004.dir/testCXXCompiler.cxx.obj -o cmTC_c0004.exe -Wl,--out-implib,libcmTC_c0004.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
LINK : warning LNK4044: unrecognized option '/-out-implib'; ignored
LINK : warning LNK4044: unrecognized option '/-major-image-version'; ignored
LINK : warning LNK4044: unrecognized option '/-minor-image-version'; ignored
LINK : fatal error LNK1181: cannot open input file 'libcmTC_c0004.dll.a'
clang++.exe: error: linker command failed with exit code 1181 (use -v to see invocation)
ninja: build stopped: subcommand failed.
奇怪的是,CMakeFiles / CMakeTmp /中没有文件。
Strange thing is that no file exists in CMakeFiles/CMakeTmp/. How can I get it to work?
推荐答案
简而言之,您定义的工具链错误。 CMake认为您使用的MSVC编译器的路径不同。有关详细答案,请参见此问题。请注意,您仍然需要MSVC或Cygwin作为构建环境。
Simply put, you are defining your toolchain wrong. CMake thinks you are using the MSVC compiler with a different path. See this question for a detailed answer. Note that you will still need MSVC or Cygwin as a build environment.
这篇关于Windows上的Clang和CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文