Skip to content

Instantly share code, notes, and snippets.

@gicmo
Created March 31, 2015 07:32
Show Gist options
  • Save gicmo/e394737efa88fcf0dae6 to your computer and use it in GitHub Desktop.
Save gicmo/e394737efa88fcf0dae6 to your computer and use it in GitHub Desktop.
CMake for Qt5 projects with qcustomplot skeleton
cmake_minimum_required(VERSION 2.8.11)
project(testproject)
message($ENV{QT5_DIR})
if($ENV{QT5_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{QT5_DIR}/lib/cmake")
endif()
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Find the QtWidgets library
find_package(Qt5Widgets)
find_package(Qt5PrintSupport)
QT5_WRAP_UI(QT_UIS_HDRS
mainwindow.ui)
# Tell CMake to create the helloworld executable
add_executable(helloworld qcustomplot.cpp main.cpp mainwindow.cpp ${QT_UIS_HDRS})
# Use the Widgets module from Qt 5.
target_link_libraries(helloworld Qt5::Widgets Qt5::PrintSupport)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment