view ui/CMakeLists.txt @ 383:5eb7ee4ee819

Look up executable name based on /proc/self/exe
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 17:47:07 +0200
parents 78eec57bc133
children 35d6b371ba63
line wrap: on
line source
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${POLARSSL_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common)
add_definitions(${Qt5Widgets_DEFINITIONS})

set(CERTIFICATELIST_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp
)

set(DOWNLOADER_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/sslconnection.cpp
)

set(M13UI_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.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
    ${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
    ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp
    ${CERTIFICATELIST_SOURCES}
)

# Seperated to make it easier to include the sources in tests
set(M13UI_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} ${M13UI_SOURCES} TARGET_NAME m13_cppcheck)
add_dependencies(static_check m13_cppcheck)

# Adding resources here in an extra variable to enable reuse of
# M13UI_SOURCES in the test subdirectory.
set(M13UI_SOURCES_WITH_RESOURCES ${M13UI_SOURCES})
qt5_add_resources(M13UI_SOURCES_WITH_RESOURCES ${M13UI_RESOURCES})
add_executable(m13ui ${M13UI_SOURCES_WITH_RESOURCES})

target_link_libraries(m13ui Qt5::Widgets
   m13_common
   ${POLARSSL_LIBRARIES}
   ${EXTRA_STATIC_LIBS}
   ${PROFILING_LIBS})

set(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_SOURCES})
qt5_add_resources(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES})
add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES})

target_link_libraries(administrator Qt5::Widgets
   m13_common
   ${POLARSSL_LIBRARIES}
   ${EXTRA_STATIC_LIBS}
   ${PROFILING_LIBS})

# Tests
add_subdirectory(tests)

install(TARGETS m13ui DESTINATION bin)
install(TARGETS administrator DESTINATION bin)

http://wald.intevation.org/projects/trustbridge/