File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 3.19)
2
+ project (test )
3
+
4
+ set (CMAKE_CXX_STANDARD 11)
5
+ set (CMAKE_AUTOMOC ON )
6
+ set (CMAKE_AUTORCC ON )
7
+ set (CMAKE_AUTOUIC ON )
8
+
9
+ set (QT_VERSION 5)
10
+ set (REQUIRED_LIBS Core Gui Widgets)
11
+ set (REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
12
+
13
+ add_executable (${PROJECT_NAME} main.cpp)
14
+
15
+
16
+ set (CMAKE_PREFIX_PATH "D:/software/Qt5.13.0/mingw73_64/lib/cmake/Qt5" )
17
+
18
+
19
+ if (NOT CMAKE_PREFIX_PATH )
20
+ message (WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
21
+ "(-DCMAKE_PREFIX_PATH=\" path/to/Qt/lib/cmake\" or -DCMAKE_PREFIX_PATH=/usr/include/{host}/qt{version}/ on Ubuntu)" )
22
+ endif ()
23
+
24
+
25
+ find_package (Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
26
+ target_link_libraries (${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED} )
27
+
28
+
29
+
Original file line number Diff line number Diff line change
1
+ #include < QApplication>
2
+ #include < QPushButton>
3
+
4
+ int main (int argc, char *argv[]) {
5
+ QApplication a (argc, argv);
6
+ QPushButton button (" Hello world!" , nullptr );
7
+ button.resize (200 , 100 );
8
+ button.show ();
9
+ return QApplication::exec ();
10
+ }
You can’t perform that action at this time.
0 commit comments