| 1 |
cmake_minimum_required(VERSION 2.8.8) |
| 2 |
project(cmake_example) |
| 3 |
|
| 4 |
# Show message on Linux platform |
| 5 |
if (${CMAKE_SYSTEM_NAME} MATCHES Linux) |
| 6 |
message("Good choice, bro!") |
| 7 |
endif() |
| 8 |
|
| 9 |
# Tell CMake to run moc when necessary: |
| 10 |
set(CMAKE_AUTOMOC ON) |
| 11 |
# As moc files are generated in the binary dir, |
| 12 |
# tell CMake to always look for includes there: |
| 13 |
set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 14 |
|
| 15 |
# Widgets finds its own dependencies. |
| 16 |
find_package(Qt5Widgets REQUIRED) |
| 17 |
|
| 18 |
add_executable(myproject main.cpp mainwindow.cpp) |
| 19 |
qt5_use_modules(myproject Widgets) |