Skip to content

Instantly share code, notes, and snippets.

@Davidj361
Last active July 28, 2018 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Davidj361/8c16d53de0c66f8cf1a1abc3627c81a3 to your computer and use it in GitHub Desktop.
Save Davidj361/8c16d53de0c66f8cf1a1abc3627c81a3 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.12.0)
project(HelloQt)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui)
set(project_ui
mainwindow.ui)
set(project_headers
mainwindow.h)
set(project_sources
main.cpp
mainwindow.cpp)
add_executable(${PROJECT_NAME} ${project_headers} ${project_sources} ${project_ui})
# Use the widgets module from Qt 5
target_link_libraries(${PROJECT_NAME}
PUBLIC
Qt5::Core
Qt5::Gui
Qt5::Widgets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment