Qt的qrc文件通过cmake在VS中编译Q_INIT_RESOURCE imagecomposition 编译

想把Qt的安装文件里的example编译到VS下运行,想法是通过cmake文件写cmakelist文件进行编译,后来碰到,Q_INIT_RESOURCE一直不能编译通过,提示不能连接,后来各种找,原来在cmake3.0之后,已经可以直接使用了。

cmake_minimum_required(VERSION 2.8.11)


project(imagecomposition)


# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Find the QtWidgets library need open
set(CMAKE_AUTORCC ON)
find_package(Qt5Widgets)
find_package(Qt5Core)


add_executable(imagecomposition WIN32 main.cpp
                                imagecomposition.qrc
imagecomposer.h
imagecomposer.cpp
)
# Use the Widgets module from Qt 5.
target_link_libraries(imagecomposition Qt5::Widgets)

你可能感兴趣的:(Qt的qrc文件通过cmake在VS中编译Q_INIT_RESOURCE imagecomposition 编译)