andre@25: # Copyright (C) 2015 by ETH Zürich andre@27: # Software engineering by Intevation GmbH andre@0: # andre@0: # This file is Free Software under the GNU GPL (v>=2) andre@0: # and comes with ABSOLUTELY NO WARRANTY! andre@0: # See LICENSE.txt for details. andre@0: andre@0: include_directories(${Qt5Widgets_INCLUDE_DIRS}) andre@0: andre@0: include_directories(${CMAKE_CURRENT_SOURCE_DIR}) andre@1: include_directories(libqxt) andre@0: andre@0: add_definitions(${Qt5Widgets_DEFINITIONS}) andre@0: andre@0: set(APPLICATION_SRC andre@0: main.cpp andre@0: mainwindow.cpp andre@0: strhelp.c andre@0: util_win.c andre@0: util_linux.c andre@2: metadataview.cpp andre@2: pngplayer.cpp andre@3: imagelabel.cpp andre@4: filterwidget.cpp andre@9: folderselectdialog.cpp andre@0: ) andre@0: andre@0: find_package(Qt5LinguistTools) andre@0: andre@0: if(UNIX) andre@0: # See: https://bugreports.qt-project.org/browse/QTBUG-35918 andre@0: # XCB_EXTRA_LIBS should be gotten automatically. andre@0: # The following list is taken from the .pri file andre@0: get_target_property(_loc Qt5::Widgets LOCATION) andre@0: get_filename_component(_qtpath ${_loc} PATH) andre@0: andre@0: set(XCB_EXTRA_LIBS andre@0: -L${_qtpath} andre@0: -lQt5DBus -lQt5Gui -lQt5Core -lQt5PlatformSupport andre@0: -lX11 -lX11-xcb -lxcb andre@0: -lXrender -lSM -lICE -ldbus-1 andre@0: -lm -ldl -lrt -lpthread ) andre@0: andre@0: elseif(WIN32) andre@0: set (_add_executable_params WIN32) andre@0: andre@0: get_target_property(_loc Qt5::Widgets LOCATION) andre@0: get_filename_component(_qtpath ${_loc} PATH) andre@0: set(WINDOWS_EXTRA_LIBS andre@0: -L${_qtpath} andre@0: -lwinspool -lshlwapi andre@0: -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm andre@0: -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32 andre@0: -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16 -lz) andre@0: andre@0: set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS}) andre@0: endif() andre@0: andre@0: set(QT_RESOURCES andre@0: ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc andre@0: # ${CMAKE_SOURCE_DIR}/img/icons.qrc andre@0: ) andre@0: andre@0: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") andre@0: qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES}) andre@0: andre@0: if(Qt5LinguistTools_FOUND) andre@0: andre@0: set(FILES_TO_TRANSLATE andre@0: ${APPLICATION_SRC} andre@0: ) andre@0: andre@0: # Include translation as a resource andre@0: # This works in the source directory to enable the rcc dependencies to be found andre@0: # and it also updates the currently available localization. andre@0: configure_file(l10n/l10n.qrc.in l10n.qrc) andre@0: qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc) andre@0: qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE} andre@0: ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts) andre@0: endif() andre@0: andre@1: add_subdirectory(libqxt) andre@1: andre@0: add_executable(${PROJECT_NAME} andre@0: ${_add_executable_params} andre@0: # ${IMG_SRC} andre@0: ${APPLICATION_SRC} andre@0: ${TRANSLATION_SRC} andre@0: # ${CMAKE_SOURCE_DIR}/img/icon.rc andre@0: ) andre@0: andre@0: andre@0: target_link_libraries(${PROJECT_NAME} andre@0: Qt5::Widgets andre@1: ${EXTRA_STATIC_LIBS} andre@1: ${PROJECT_NAME}_libqxt andre@1: ) andre@0: andre@0: if (WIN32) andre@0: set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode") andre@0: endif(WIN32) andre@0: andre@0: install(TARGETS ${PROJECT_NAME} DESTINATION bin)