view src/CMakeLists.txt @ 36:92bb9687d716

(issue12) Count from 1 to max + 1 This is more intutive then counting from zero
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 16:10:01 +0200
parents 5bd14af5bce5
children 97c14310cc1a
line wrap: on
line source
# Copyright (C) 2015 by ETH Zürich
# 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(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(libqxt)

add_definitions(${Qt5Widgets_DEFINITIONS})

set(APPLICATION_SRC
   main.cpp
   mainwindow.cpp
   strhelp.c
   util_win.c
   util_linux.c
   metadataview.cpp
   pngplayer.cpp
   imagelabel.cpp
   filterwidget.cpp
   folderselectdialog.cpp
)

find_package(Qt5LinguistTools)

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)

   set(XCB_EXTRA_LIBS
      -L${_qtpath}
      -lQt5DBus -lQt5Gui -lQt5Core -lQt5PlatformSupport
      -lX11 -lX11-xcb -lxcb
      -lXrender -lSM -lICE -ldbus-1
      -lm -ldl -lrt -lpthread )

elseif(WIN32)
   set (_add_executable_params WIN32)

   get_target_property(_loc Qt5::Widgets LOCATION)
   get_filename_component(_qtpath ${_loc} PATH)
   set(WINDOWS_EXTRA_LIBS
        -L${_qtpath}
        -lwinspool -lshlwapi
        -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm
        -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32
        -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16 -lz)

   set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS})
endif()

set(QT_RESOURCES
   ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc
   #   ${CMAKE_SOURCE_DIR}/img/icons.qrc
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES})

if(Qt5LinguistTools_FOUND)

   set(FILES_TO_TRANSLATE
      ${APPLICATION_SRC}
   )

   # 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.
   configure_file(l10n/l10n.qrc.in l10n.qrc)
   qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc)
   qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE}
      ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts)
endif()

add_subdirectory(libqxt)

add_executable(${PROJECT_NAME}
   ${_add_executable_params}
   #   ${IMG_SRC}
   ${APPLICATION_SRC}
   ${TRANSLATION_SRC}
   #   ${CMAKE_SOURCE_DIR}/img/icon.rc
   )


target_link_libraries(${PROJECT_NAME}
   Qt5::Widgets
   ${EXTRA_STATIC_LIBS}
   ${PROJECT_NAME}_libqxt
)

if (WIN32)
   set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode")
endif(WIN32)

install(TARGETS ${PROJECT_NAME} DESTINATION bin)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)