cmake_minimum_required(VERSION 3.5)
project(Test LANGUAGES CXX)
//这里
file(GLOB_RECURSE QRC_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
//这里
set(QRC_SOURCE_FILES Resources.qrc)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
//这里
qt5_add_resources(QRC_FILES ${QRC_SOURCE_FILES})
//这里
SOURCE_GROUP("Resource Files" FILES ${QRC_SOURCE_FILES})
if(ANDROID)
add_library(Test SHARED
main.cpp
ui_mainwindow.h
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
else()
add_executable(Test
main.cpp
//这里
${QRC_FILES}
ui_mainwindow.h
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
endif()
target_link_libraries(Test PRIVATE Qt5::Widgets)
|