summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 28d953f14be4211c605fe451bf4d2e2a9debf907 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

# Since some distro (debian) doesn't have a qt5 version of liblightdm-qt5, let's just ship it
OPTION(USE_INCLUDED_LDMQT "Use included liblightdm-qt" OFF)

PROJECT(qt-lightdm-greeter)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

file(GLOB SRCS src/*.cpp src/*.c)
file(GLOB UIS src/*.ui)

FIND_PACKAGE(Qt5 COMPONENTS Widgets X11Extras Svg Network REQUIRED)
FIND_PACKAGE(X11 REQUIRED)

IF(X11_Xscreensaver_FOUND)
    ADD_DEFINITIONS(-DX11_Xscreensaver_FOUND)
ENDIF()

QT5_ADD_RESOURCES(RSCS qt-lightdm-greeter.qrc)

QT5_WRAP_UI(UI_HEADERS ${UIS})

# Some cmake versions can't understand the CMAKE_CXX_STANDARD option above?
SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -std=c++11" )

IF (USE_INCLUDED_LDMQT)
    message( FATAL_ERROR "Using included liblightdm-qt is not implemented" )
    SET( LIGHTDM_QT_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblightdm-qt" )
    SET( LIGHTDM_QT_LIBRARIES "" )
    FILE(GLOB LQT_SRCS src/liblightdm-qt/*.cpp)
    SET( SRCS ${SRCS} ${LQT_SRCS} )
    # TODO
    # pkg check modules liblightdm-gobject(-1)-dev
ELSE()
    include(FindPkgConfig)
    pkg_check_modules(LIGHTDM_QT liblightdm-qt5-3)
    if (NOT LIGHTDM_QT_INCLUDE_DIRS)
        MESSAGE( FATAL_ERROR "Cannot find liblightdm-qt" )
    endif()
ENDIF()

include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}
                      ${CMAKE_CURRENT_BINARY_DIR}
                      ${LIGHTDM_QT_INCLUDE_DIRS}
)

add_executable ( qt-lightdm-greeter ${SRCS} ${RSCS} ${UI_HEADERS} )

target_link_libraries ( qt-lightdm-greeter
    Qt5::Widgets
    Qt5::X11Extras
    Qt5::Svg
    Qt5::Network
    ${LIGHTDM_QT_LIBRARIES}
    ${X11_LIBRARIES}
    ${X11_Xscreensaver_LIB}
)


install(TARGETS ${PROJECT} RUNTIME DESTINATION bin)
install(FILES   qt-lightdm-greeter.desktop  DESTINATION /usr/share/xgreeters)

if (NOT KEEP_CONFIGS)
    install(FILES qt-lightdm-greeter.conf DESTINATION /etc/lightdm)
endif()