aheinecke@405: # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@405: # Software engineering by Intevation GmbH aheinecke@405: # aheinecke@405: # This file is Free Software under the GNU GPL (v>=2) aheinecke@405: # and comes with ABSOLUTELY NO WARRANTY! aheinecke@405: # See LICENSE.txt for details. aheinecke@405: andre@33: include_directories(${Qt5Widgets_INCLUDE_DIRS}) aheinecke@57: include_directories(${POLARSSL_INCLUDE_DIR}) aheinecke@254: include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common) andre@33: add_definitions(${Qt5Widgets_DEFINITIONS}) andre@33: aheinecke@411: find_package(Qt5LinguistTools) aheinecke@411: aheinecke@520: # Common code is used in either the client or the administrator aheinecke@496: # application or in unit tests. aheinecke@496: set(UICOMMON_SOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp aheinecke@45: ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection.cpp aheinecke@452: ${CMAKE_CURRENT_SOURCE_DIR}/sslhelp.cpp aheinecke@45: ) aheinecke@45: aheinecke@497: # Cmake does not correctly identify gcc windres when cross compiling aheinecke@497: # making this line neccessary to set the correct flags for it. aheinecke@497: # See: http://public.kitware.com/Bug/view.php?id=11773 aheinecke@497: SET(CMAKE_RC_COMPILE_OBJECT aheinecke@497: " -Ocoff ") aheinecke@497: aheinecke@407: set(TRUSTBRIDGE_SOURCES aheinecke@496: ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp rrenkert@190: ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp rrenkert@266: ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemdelegate.cpp rrenkert@273: ${CMAKE_CURRENT_SOURCE_DIR}/separatoritemdelegate.cpp aheinecke@257: ${CMAKE_CURRENT_SOURCE_DIR}/installwrapper.cpp aheinecke@497: ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc aheinecke@527: ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp andre@33: ${CERTIFICATELIST_SOURCES} aheinecke@45: ${DOWNLOADER_SOURCES} andre@33: ) andre@33: aheinecke@572: set(ADMINISTRATOR_SOURCES rrenkert@333: ${CMAKE_CURRENT_SOURCE_DIR}/administratorwindow.cpp rrenkert@335: ${CMAKE_CURRENT_SOURCE_DIR}/certificatetablemodel.cpp rrenkert@348: ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp rrenkert@362: ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp aheinecke@527: ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp aheinecke@527: ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp rrenkert@566: ${CMAKE_CURRENT_SOURCE_DIR}/certificatediffdialog.cpp rrenkert@327: ${CERTIFICATELIST_SOURCES} rrenkert@327: ) rrenkert@327: andre@33: # Seperated to make it easier to include the sources in tests aheinecke@407: set(TRUSTBRIDGE_RESOURCES andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc andre@33: ${CMAKE_CURRENT_SOURCE_DIR}/certs.qrc andre@33: ) andre@33: aheinecke@572: set(ADMINISTRATOR_RESOURCES rrenkert@327: ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc rrenkert@327: ) rrenkert@327: 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) aheinecke@107: aheinecke@107: if(NOT XKBCOMMON_LIB) aheinecke@107: # Hack on a hack to overwrite the xkbcommon libname. aheinecke@107: set(XKBCOMMON_LIB -lxkbcommon) aheinecke@108: endif() aheinecke@107: 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 aheinecke@107: ${XKBCOMMON_LIB} -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: aheinecke@409: generate_cppcheck(SOURCES ${CINST_SOURCES} ${TRUSTBRIDGE_SOURCES} TARGET_NAME custom_cppcheck) aheinecke@409: add_dependencies(static_check custom_cppcheck) andre@33: andre@33: # Adding resources here in an extra variable to enable reuse of aheinecke@407: # TRUSTBRIDGE_SOURCES in the test subdirectory. aheinecke@561: set(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) aheinecke@561: qt5_add_resources(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES}) andre@33: aheinecke@572: set(ADMINISTRATOR_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp) aheinecke@572: qt5_add_resources(ADMINISTRATOR_MAIN_WITH_RESOURCES ${ADMINISTRATOR_RESOURCES}) aheinecke@411: aheinecke@514: if(WIN32) aheinecke@514: # This option causes cmake to use the appropiate liker flags to hide aheinecke@514: # the console Window on Windows aheinecke@514: set (_add_executable_params WIN32) aheinecke@514: endif() aheinecke@514: aheinecke@411: if(Qt5LinguistTools_FOUND) aheinecke@420: # Include translation as a resource aheinecke@420: # This works in the source directory to enable the rcc dependencies to be found aheinecke@420: # and it also updates the currently available localization. aheinecke@420: # This would probably be better placed in a macro aheinecke@420: configure_file(l10n/administrator.qrc.in administrator.qrc) aheinecke@420: qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc) aheinecke@572: qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINISTRATOR_SOURCES} aheinecke@420: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts) aheinecke@520: add_executable(trustbridge-admin aheinecke@514: ${_add_executable_params} aheinecke@572: ${ADMINISTRATOR_MAIN_WITH_RESOURCES} aheinecke@420: ${ADMINISTRATOR_L10N} aheinecke@420: ${ADMINISTRATOR_TRANSLATION} aheinecke@420: ) aheinecke@421: aheinecke@421: configure_file(l10n/trustbridge.qrc.in trustbridge.qrc) aheinecke@421: qt5_add_resources(TRUSTBRIDGE_L10N ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.qrc) aheinecke@561: qt5_create_translation(TRUSTBRIDGE_TRANSLATION ${TRUSTBRIDGE_SOURCES} aheinecke@421: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/trustbridge_de_DE.ts) aheinecke@514: add_executable(trustbridge aheinecke@514: ${_add_executable_params} aheinecke@561: ${TRUSTBRIDGE_MAIN_WITH_RESOURCES} aheinecke@421: ${TRUSTBRIDGE_L10N} aheinecke@421: ${TRUSTBRIDGE_TRANSLATION} aheinecke@421: ) aheinecke@421: aheinecke@411: else() aheinecke@421: message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.") aheinecke@520: add_executable(trustbridge-admin aheinecke@514: ${_add_executable_params} aheinecke@572: ${ADMINISTRATOR_MAIN_WITH_RESOURCES}) aheinecke@514: add_executable(trustbridge aheinecke@514: ${_add_executable_params} aheinecke@561: ${TRUSTBRIDGE_MAIN_WITH_RESOURCES}) aheinecke@411: endif() rrenkert@327: aheinecke@496: add_library(ui_common STATIC ${UICOMMON_SOURCES}) aheinecke@572: add_library(tbadminlib STATIC ${ADMINISTRATOR_SOURCES}) aheinecke@561: add_library(tblib STATIC ${TRUSTBRIDGE_SOURCES}) aheinecke@496: aheinecke@560: target_link_libraries(trustbridge-admin aheinecke@560: tbadminlib aheinecke@560: Qt5::Widgets aheinecke@496: ui_common aheinecke@408: trustbridge_common rrenkert@327: ${POLARSSL_LIBRARIES} rrenkert@327: ${EXTRA_STATIC_LIBS} rrenkert@327: ${PROFILING_LIBS}) rrenkert@327: aheinecke@560: target_link_libraries(trustbridge aheinecke@560: tblib aheinecke@560: Qt5::Widgets aheinecke@496: ui_common aheinecke@421: trustbridge_common aheinecke@421: ${POLARSSL_LIBRARIES} aheinecke@421: ${EXTRA_STATIC_LIBS} aheinecke@421: ${PROFILING_LIBS}) aheinecke@421: aheinecke@421: andre@33: # Tests andre@33: add_subdirectory(tests) aheinecke@124: aheinecke@407: install(TARGETS trustbridge DESTINATION bin) aheinecke@520: install(TARGETS trustbridge-admin DESTINATION bin)