有没有人遇到过这个问题
Unsolved
Chinese
-
cmake_minimum_required(VERSION 3.5) project(alnum VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) file(GLOB PROJECT_SOURCES CONFIGURE_DEPENDS *.cpp *.h ui/*.ui) qt_add_resources(PROJECT_SOURCES resources.qrc) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(alnum MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET alnum APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation else() if(ANDROID) add_library(alnum SHARED ${PROJECT_SOURCES} ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") else() add_executable(alnum ${PROJECT_SOURCES} ) endif() endif()
上面是cmake代码的一部分,我想把ui所有的文件放在项目的
ui/
路径下面,然后我的代码是在(看下)> tree -L 1 . ├── CMakeLists.txt ├── CMakeLists.txt.user ├── album ├── build-alnum-Desktop_Qt_6_4_1_MinGW_64_bit-Debug ├── confirmwizardpage.cpp ├── confirmwizardpage.h ├── icon ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── music ├── projectsettingwizardpage.cpp ├── projectsettingwizardpage.h ├── resources.qrc ├── style ├── ui ├── wizard.cpp └── wizard.h 6 directories, 12 files
我把ui直接放在外面就可与成功编译,但是放在文件夹
ui
下面就出现编译问题了AutoUic error ------------- "SRC:/confirmwizardpage.cpp" includes the uic file "ui_confirmwizardpage.h", but the user interface file "confirmwizardpage.ui" could not be found in the following directories "SRC:" ninja: build stopped: subcommand failed. 20:19:41: 进程"E:\Qt\Tools\CMake_64\bin\cmake.exe"退出,退出代码 1 。 Error while building/deploying project alnum (kit: Desktop Qt 6.4.1 MinGW 64-bit) When executing step "构建" 20:19:41: Elapsed time: 00:00.
有没有人知道如何解决这个问题?谢谢大佬