Что у меня есть
- Windows 10 x64
- MinGW-w64 toolchain 7.3.0, 32 + 64, 64-битная версия установлена в PATH
- CLang Windows дистрибутив6.0.0, 32 + 64, 64-битная версия, установленная в PATH
- CLion 2018.1 и встроенный cmake
- Установить предпочтение CMake внутри CLion после этого поста
- Не будет установленными инструментами сборки VS или VS.
- Может скомпилировать файлы cpp из командной строки как с
g++
, так и с clang++
без ошибок.Для clang++
я должен установить флаг -target x86_64-pc-mingw64
из-за отсутствия VC toolchain и заголовков.
Что я хочу
Установить функциональный профиль CMake с помощью компилятора clang++
.
Я установил профиль CMake по ссылке выше.Тем не менее, clion выдает ошибку
The Clang compiler tool
"C:/Program Files/LLVM/bin/clang.exe"
targets the MSVC ABI but has a GNU-like command-line interface. This is
not supported. Use 'clang-cl' instead, e.g. by setting 'CC=clang-cl' in
the environment. Furthermore, use the MSVC command-line environment.
Если я установлю C и CXX COMPILERs на clang-cl
вместо того, чтобы установить TOOLCHAIN PREFIX на LLVM
, возникнет ошибка.
CMake Error at C:/Program Files/JetBrains/CLion
2018.1/bin/cmake/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52
(message):
The C compiler
"C:/Program Files/LLVM/bin/clang-cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/huang/Documents/Programs/grade/cmake-build-release-
clang-1/CMakeFiles/CMakeTmp
Run Build Command:"C:/mingw64/bin/mingw32-make.exe" "cmTC_181bf/fast"
C:/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_181bf.dir\build.make
CMakeFiles/cmTC_181bf.dir/build
mingw32-make.exe[1]: Entering directory
'C:/Users/huang/Documents/Programs/grade/cmake-build-release-clang-
1/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_181bf.dir/testCCompiler.c.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd
/Zi /Ob0 /Od /RTC1 /FoCMakeFiles\cmTC_181bf.dir\testCCompiler.c.obj
/FdCMakeFiles\cmTC_181bf.dir/ -c
C:\Users\huang\Documents\Programs\grade\cmake-build-release-clang-
1\CMakeFiles\CMakeTmp\testCCompiler.c
Linking C executable cmTC_181bf.exe
"C:\Program Files\JetBrains\CLion 2018.1\bin\cmake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_181bf.dir\link.txt --verbose=1
"C:\Program Files\JetBrains\CLion 2018.1\bin\cmake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_181bf.dir --manifests -- CMAKE_LINKER-NOTFOUND /nologo @CMakeFiles\cmTC_181bf.dir\objects1.rsp /out:cmTC_181bf.exe /implib:cmTC_181bf.lib /pdb:C:\Users\huang\Documents\Programs\grade\cmake-build-release-clang-1\CMakeFiles\CMakeTmp\cmTC_181bf.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
RC Pass 1: command "rc /foCMakeFiles\cmTC_181bf.dir/manifest.res CMakeFiles\cmTC_181bf.dir/manifest.rc" failed (exit code 0) with the following output:
缁崵绮洪幍鍙ョ瑝閸掔増瀵氱�规氨娈戦弬鍥︽閵嗕慷ingw32-make.exe[1]: *** [CMakeFiles\cmTC_181bf.dir\build.make:98: cmTC_181bf.exe] Error -1
mingw32-make.exe[1]: Leaving directory 'C:/Users/huang/Documents/Programs/grade/cmake-build-release-clang-1/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:125: cmTC_181bf/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Я предполагаю, что это может быть потому, что я не установил цель, как я это сделаю в командной строке, и целью по умолчанию является VC.В интерфейсе CLion как мне это сделать?