我正在尝试将Qt 6库添加到现有的Clang项目中。
我已经下载了MSVC的编译Qt库。我已经读到它们是ABI兼容Clang的。但是我甚至没有走那么远,因为CMake让我很难设置一些不兼容的编译器标志-permissive-
和-Zc:__cplusplus
。
下面是项目:
cmake_minimum_required(VERSION 3.16)
project(drawing CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC TRUE)
find_package(Qt6 COMPONENTS Widgets)
add_executable("drawing" drawing.cpp)
target_link_libraries("drawing" Qt6::Widgets)
我按如下方式设置环境:
set PATH=C:\Qt\6.3.1\msvc2019_64\bin;%PATH%
set PATH=%PATH%;C:\Qt\Tools\CMake_64\bin;C:\Qt\Tools\Ninja
set PATH=C:\Program Files\LLVM\bin;%PATH%
然后将项目生成为
cmake -H.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
这会产生以下错误:
[2/4] Building CXX object CMakeFiles/drawing.dir/drawing_autogen/mocs_compilation.cpp.obj
FAILED: CMakeFiles/drawing.dir/drawing_autogen/mocs_compilation.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Users/brugg/Desktop/logiksim3/drawing/build/drawing_autogen/include -isystem C:/Qt/6.3.1/msvc2019_64/include/QtWidgets -isystem C:/Qt/6.3.1/msvc2019_64/include -isystem C:/Qt/6.3.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.3.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.3.1/msvc2019_64/include/QtGui -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -Zc:__cplusplus -permissive- -utf-8 -std=gnu++17 -MD -MT CMakeFiles/drawing.dir/drawing_autogen/mocs_compilation.cpp.obj -MF CMakeFiles\drawing.dir\drawing_autogen\mocs_compilation.cpp.obj.d -o CMakeFiles/drawing.dir/drawing_autogen/mocs_compilation.cpp.obj -c C:/Users/brugg/Desktop/logiksim3/drawing/build/drawing_autogen/mocs_compilation.cpp
CLANG_~1: error: unknown argument: '-permissive-'
CLANG_~1: error: unsupported use of internal gcc -Z option '-Zc:__cplusplus'
[3/4] Building CXX object CMakeFiles/drawing.dir/drawing.cpp.obj
FAILED: CMakeFiles/drawing.dir/drawing.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Users/brugg/Desktop/logiksim3/drawing/build/drawing_autogen/include -isystem C:/Qt/6.3.1/msvc2019_64/include/QtWidgets -isystem C:/Qt/6.3.1/msvc2019_64/include -isystem C:/Qt/6.3.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.3.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.3.1/msvc2019_64/include/QtGui -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -Zc:__cplusplus -permissive- -utf-8 -std=gnu++17 -MD -MT CMakeFiles/drawing.dir/drawing.cpp.obj -MF CMakeFiles\drawing.dir\drawing.cpp.obj.d -o CMakeFiles/drawing.dir/drawing.cpp.obj -c C:/Users/brugg/Desktop/logiksim3/drawing/drawing.cpp
CLANG_~1: error: unknown argument: '-permissive-'
CLANG_~1: error: unsupported use of internal gcc -Z option '-Zc:__cplusplus'
ninja: build stopped: subcommand failed.
我还需要什么?
1条答案
按热度按时间vlju58qv1#
这将再次删除无效的编译器标志: