aheinecke@0: cmake_minimum_required(VERSION 2.8.8) aheinecke@0: project(m13) aheinecke@0: aheinecke@0: set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") aheinecke@0: aheinecke@0: # Use cmake's automoc and make sure the generated files are included aheinecke@0: set(CMAKE_AUTOMOC ON) aheinecke@0: set(CMAKE_INCLUDE_CURRENT_DIR ON) aheinecke@0: aheinecke@0: find_package(Qt5Widgets REQUIRED) aheinecke@0: aheinecke@0: include_directories(${Qt5Widgets_INCLUDE_DIRS}) aheinecke@0: add_definitions(${Qt5Widgets_DEFINITIONS}) aheinecke@0: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") aheinecke@0: aheinecke@0: set(M13UI_SOURCES aheinecke@0: ui/main.cpp aheinecke@0: ui/mainwindow.cpp aheinecke@0: ) aheinecke@0: aheinecke@0: set(M13UI_RESOURCES aheinecke@0: ui/icons.qrc aheinecke@0: ) aheinecke@0: aheinecke@0: if(UNIX) aheinecke@0: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 aheinecke@0: # XCB_EXTRA_LIBS should be gotten automatically. aheinecke@0: # The following list is taken from the .pri file aheinecke@0: get_target_property(_loc Qt5::Widgets LOCATION) aheinecke@0: get_filename_component(_qtpath ${_loc} PATH) aheinecke@0: set(XCB_EXTRA_LIBS aheinecke@0: -L${_qtpath} aheinecke@0: -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1 aheinecke@0: -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr aheinecke@0: -lxcb-shape -lxcb-keysyms -lQt5PlatformSupport aheinecke@0: -lfreetype -lQt5DBus -lQt5Gui -ljpeg -lpng -lQt5Core aheinecke@0: -lz -lm -ldl -lrt -lpthread) aheinecke@0: aheinecke@0: set(EXTRA_STATIC_LIBS -lz -lpthread -ldl -lpng -ljpeg aheinecke@0: Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS}) aheinecke@0: elseif(WIN32) aheinecke@0: get_target_property(_loc Qt5::Widgets LOCATION) aheinecke@0: get_filename_component(_qtpath ${_loc} PATH) aheinecke@0: set(WINDOWS_EXTRA_LIBS aheinecke@0: -L${_qtpath} aheinecke@0: -lwinspool -lshlwapi -lfreetype -lbz2 -lpng16 aheinecke@0: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm aheinecke@0: -lglu32 -lopengl32 -lgdi32 -ljpeg -lpng -lQt5Core -lole32 -luuid -lws2_32 aheinecke@0: -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lsicuin -lsicuuc -lsicudt -lpcre16) aheinecke@0: set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS}) aheinecke@0: endif() aheinecke@0: aheinecke@0: qt5_add_resources(M13UI_SOURCES ${M13UI_RESOURCES}) aheinecke@0: aheinecke@0: add_executable(m13ui ${M13UI_SOURCES}) aheinecke@0: aheinecke@0: target_link_libraries(m13ui Qt5::Widgets ${EXTRA_STATIC_LIBS})