Mercurial > trustbridge
view ui/CMakeLists.txt @ 502:e551de11d8b6
Properly handle the case that the file does not exist.
TRUNCATE makes create file fail if the file does not exist
but we need TRUNCATE in the case that the file already exists
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 28 Apr 2014 09:18:07 +0000 |
parents | 5e77d1c4826c |
children | ce8325686b09 |
line wrap: on
line source
# Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik # Software engineering by Intevation GmbH # # This file is Free Software under the GNU GPL (v>=2) # and comes with ABSOLUTELY NO WARRANTY! # See LICENSE.txt for details. include_directories(${Qt5Widgets_INCLUDE_DIRS}) include_directories(${POLARSSL_INCLUDE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common) add_definitions(${Qt5Widgets_DEFINITIONS}) find_package(Qt5LinguistTools) # Common code is used in either the client or the administrat # application or in unit tests. set(UICOMMON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sslhelp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp ) # Cmake does not correctly identify gcc windres when cross compiling # making this line neccessary to set the correct flags for it. # See: http://public.kitware.com/Bug/view.php?id=11773 SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -Ocoff <SOURCE> <OBJECT>") set(TRUSTBRIDGE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/statusdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemdelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/separatoritemdelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/installwrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc ${CERTIFICATELIST_SOURCES} ${DOWNLOADER_SOURCES} ) set(ADMINSTRATOR_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/administratorwindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificatetablemodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp ${CERTIFICATELIST_SOURCES} ) # Seperated to make it easier to include the sources in tests set(TRUSTBRIDGE_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc ${CMAKE_CURRENT_SOURCE_DIR}/certs.qrc ) set(ADMINSTRATOR_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc ) if(UNIX) # See: https://bugreports.qt-project.org/browse/QTBUG-35918 # XCB_EXTRA_LIBS should be gotten automatically. # The following list is taken from the .pri file get_target_property(_loc Qt5::Widgets LOCATION) get_filename_component(_qtpath ${_loc} PATH) if(NOT XKBCOMMON_LIB) # Hack on a hack to overwrite the xkbcommon libname. set(XKBCOMMON_LIB -lxkbcommon) endif() set(XCB_EXTRA_LIBS -L${_qtpath} -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1 -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr ${XKBCOMMON_LIB} -lxcb-shape -lxcb-keysyms -lQt5PlatformSupport -lfreetype -lQt5DBus -lQt5Gui -ljpeg -lpng -lQt5Core -lz -lm -ldl -lrt -lpthread) set(EXTRA_STATIC_LIBS -lz -lpthread -ldl -lpng -ljpeg Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS}) elseif(WIN32) get_target_property(_loc Qt5::Widgets LOCATION) get_filename_component(_qtpath ${_loc} PATH) set(WINDOWS_EXTRA_LIBS -L${_qtpath} -lwinspool -lshlwapi -lfreetype -lbz2 -lpng16 -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm -lglu32 -lopengl32 -lgdi32 -ljpeg -lpng -lQt5Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lsicuin -lsicuuc -lsicudt -lpcre16) set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS} -lwinhttp -lcrypt32) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") generate_cppcheck(SOURCES ${CINST_SOURCES} ${TRUSTBRIDGE_SOURCES} TARGET_NAME custom_cppcheck) add_dependencies(static_check custom_cppcheck) # Adding resources here in an extra variable to enable reuse of # TRUSTBRIDGE_SOURCES in the test subdirectory. set(TRUSTBRIDGE_SOURCES_WITH_RESOURCES ${TRUSTBRIDGE_SOURCES}) qt5_add_resources(TRUSTBRIDGE_SOURCES_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES}) set(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_SOURCES}) qt5_add_resources(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES}) if(Qt5LinguistTools_FOUND) # Include translation as a resource # This works in the source directory to enable the rcc dependencies to be found # and it also updates the currently available localization. # This would probably be better placed in a macro configure_file(l10n/administrator.qrc.in administrator.qrc) qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc) qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINSTRATOR_SOURCES_WITH_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts) add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES} ${ADMINISTRATOR_L10N} ${ADMINISTRATOR_TRANSLATION} ) configure_file(l10n/trustbridge.qrc.in trustbridge.qrc) qt5_add_resources(TRUSTBRIDGE_L10N ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.qrc) qt5_create_translation(TRUSTBRIDGE_TRANSLATION ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/l10n/trustbridge_de_DE.ts) add_executable(trustbridge ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES} ${TRUSTBRIDGE_L10N} ${TRUSTBRIDGE_TRANSLATION} ) else() message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.") add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES}) add_executable(trustbridge ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES}) endif() add_library(ui_common STATIC ${UICOMMON_SOURCES}) target_link_libraries(administrator Qt5::Widgets ui_common trustbridge_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS} ${PROFILING_LIBS}) target_link_libraries(trustbridge Qt5::Widgets ui_common trustbridge_common ${POLARSSL_LIBRARIES} ${EXTRA_STATIC_LIBS} ${PROFILING_LIBS}) # Tests add_subdirectory(tests) install(TARGETS trustbridge DESTINATION bin) install(TARGETS administrator DESTINATION bin)