CMake构建Qt5的VS2015项目 (Hello Qt5)

Qt5的编译

Windows下载编译Qt5 Gui

CMakeLists.txt 源码

cmake_minimum_required(VERSION 2.8.11)
project(HelloQt5)
# Find the QtWidgets library
find_package(Qt5Widgets)
# Tell CMake to create the HelloQt5 executable
add_executable(HelloQt5 WIN32 main.cpp)
# Use the Widgets module from Qt 5.
target_link_libraries(HelloQt5 Qt5::Widgets)

main.cpp 源码

#include <QApplication>
#include <QLabel>

int main(int argc, char* argv[])
{
	QApplication app(argc, argv);
	QLabel *label = new QLabel("Hello Qt5!");
	label->show();
	return app.exec();
}
原文地址:https://www.cnblogs.com/dilex/p/10630249.html