Changeset View
Changeset View
Standalone View
Standalone View
app_templates/cpp/CMake/cmake_qt5guiapp/CMakeLists.txt
1 | cmake_minimum_required(VERSION 2.8.11) | 1 | cmake_minimum_required(VERSION 3.0) | ||
---|---|---|---|---|---|
2 | project(%{APPNAME}) | 2 | project(%{APPNAME}) | ||
3 | 3 | | |||
4 | # Find includes in corresponding build directories | 4 | # Find includes in corresponding build directories | ||
5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
6 | # Instruct CMake to run moc automatically when needed. | 6 | # Instruct CMake to run moc automatically when needed. | ||
7 | set(CMAKE_AUTOMOC ON) | 7 | set(CMAKE_AUTOMOC ON) | ||
8 | # Instruct CMake to create code from Qt designer ui files | ||||
9 | set(CMAKE_AUTOUIC ON) | ||||
8 | 10 | | |||
9 | # Find the QtWidgets library | 11 | # Find the QtWidgets library | ||
10 | find_package(Qt5Widgets CONFIG REQUIRED) | 12 | find_package(Qt5Widgets CONFIG REQUIRED) | ||
11 | 13 | | |||
12 | set(%{APPNAMELC}_SRC | 14 | set(%{APPNAMELC}_SRC | ||
13 | src/main.cpp | 15 | src/main.cpp | ||
14 | src/%{APPNAMELC}.cpp | 16 | src/%{APPNAMELC}.cpp | ||
15 | ) | 17 | ) | ||
16 | 18 | | |||
17 | # Create code from a list of Qt designer ui files. | | |||
18 | #set(CMAKE_AUTOUIC ON) # use this if you have CMake 3.x instead of the following | | |||
19 | qt5_wrap_ui(%{APPNAMELC}_SRC src/%{APPNAMELC}.ui) | | |||
20 | | ||||
21 | # Tell CMake to create the helloworld executable | 19 | # Tell CMake to create the helloworld executable | ||
22 | add_executable(%{APPNAMELC} ${%{APPNAMELC}_SRC}) | 20 | add_executable(%{APPNAMELC} ${%{APPNAMELC}_SRC}) | ||
23 | 21 | | |||
24 | # Use the Widgets module from Qt 5. | 22 | # Use the Widgets module from Qt 5. | ||
25 | target_link_libraries(%{APPNAMELC} Qt5::Widgets) | 23 | target_link_libraries(%{APPNAMELC} Qt5::Widgets) | ||
26 | 24 | | |||
27 | # Install the executable | 25 | # Install the executable | ||
28 | install(TARGETS %{APPNAMELC} DESTINATION bin) | 26 | install(TARGETS %{APPNAMELC} DESTINATION bin) |