andre@33: find_package(Qt5Widgets REQUIRED) andre@33: andre@33: include_directories(${Qt5Widgets_INCLUDE_DIRS}) andre@33: add_definitions(${Qt5Widgets_DEFINITIONS}) andre@33: andre@33: set(CERTIFICATELIST_SOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificate_win.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificate_linux.cpp andre@33: ${CMAKE_SOURCE_DIR}/common/listutil.c andre@33: ) andre@33: andre@33: set(M13UI_SOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/downloader_win.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/downloader_linux.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp andre@33: ${CERTIFICATELIST_SOURCES} andre@33: ) andre@33: andre@33: # Seperated to make it easier to include the sources in tests andre@33: set(M13UI_RESOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certs.qrc andre@33: ) andre@33: andre@33: if(UNIX) andre@33: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 andre@33: # XCB_EXTRA_LIBS should be gotten automatically. andre@33: # The following list is taken from the .pri file andre@33: get_target_property(_loc Qt5::Widgets LOCATION) andre@33: get_filename_component(_qtpath ${_loc} PATH) andre@33: set(XCB_EXTRA_LIBS andre@33: -L${_qtpath} andre@33: -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1 andre@33: -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr andre@33: -lxkbcommon -lxcb-shape -lxcb-keysyms -lQt5PlatformSupport andre@33: -lfreetype -lQt5DBus -lQt5Gui -ljpeg -lpng -lQt5Core andre@33: -lz -lm -ldl -lrt -lpthread) andre@33: andre@33: set(EXTRA_STATIC_LIBS -lz -lpthread -ldl -lpng -ljpeg andre@33: Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS}) andre@33: andre@33: elseif(WIN32) andre@33: get_target_property(_loc Qt5::Widgets LOCATION) andre@33: get_filename_component(_qtpath ${_loc} PATH) andre@33: set(WINDOWS_EXTRA_LIBS andre@33: -L${_qtpath} andre@33: -lwinspool -lshlwapi -lfreetype -lbz2 -lpng16 andre@33: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm andre@33: -lglu32 -lopengl32 -lgdi32 -ljpeg -lpng -lQt5Core -lole32 -luuid -lws2_32 andre@33: -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lsicuin -lsicuuc -lsicudt -lpcre16) andre@33: andre@33: set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS} -lwinhttp -lcrypt32) andre@33: endif() andre@33: andre@33: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") andre@33: andre@33: generate_cppcheck(SOURCES ${CINST_SOURCES} ${M13UI_SOURCES} TARGET_NAME m13) andre@33: add_dependencies(static_check cppcheck) andre@33: andre@33: # Adding resources here in an extra variable to enable reuse of andre@33: # M13UI_SOURCES in the test subdirectory. andre@33: set(M13UI_SOURCES_WITH_RESOURCES ${M13UI_SOURCES}) andre@33: qt5_add_resources(M13UI_SOURCES_WITH_RESOURCES ${M13UI_RESOURCES}) andre@33: add_executable(m13ui ${M13UI_SOURCES_WITH_RESOURCES}) andre@33: andre@33: target_link_libraries(m13ui Qt5::Widgets andre@33: ${EXTRA_STATIC_LIBS} andre@33: ${PROFILING_LIBS} andre@33: ${POLARSSL_LIBRARIES}) andre@33: andre@33: # Tests andre@33: add_subdirectory(tests)