Skip to content

Instantly share code, notes, and snippets.

@walsvid
Created June 7, 2016 07:37
Show Gist options
  • Save walsvid/5faa1b4ff5f58833f3673c5d4ed40ed3 to your computer and use it in GitHub Desktop.
Save walsvid/5faa1b4ff5f58833f3673c5d4ed40ed3 to your computer and use it in GitHub Desktop.
CMake-Template-Qt5
cmake_minimum_required(VERSION 3.5)
project(qttest)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp mainwindow.h mainwindow.cpp)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT5_DIR})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/Cellar/qt5/5.6.0/bin") # Input the directory of your Qt lib
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED)
qt5_wrap_ui(UI_HEADERS mainwindow.ui)
qt5_add_resources(QRCS resources.qrc)
add_executable(qttest ${SOURCE_FILES} ${UI_HEADERS} ${QRCS})
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment