| 1 |
project(dekko-notify) |
| 2 |
set(CMAKE_GENERATOR "Unix Makefiles") |
| 3 |
|
| 4 |
option(NOTIFY_TESTS "Enable notify tests" OFF) |
| 5 |
mark_as_advanced(NOTIFY_TESTS) |
| 6 |
|
| 7 |
set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
| 8 |
set(CMAKE_CXX_STANDARD 11) |
| 9 |
set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 10 |
set(CMAKE_CXX_EXTENSIONS OFF) |
| 11 |
set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
| 12 |
set(CMAKE_AUTOMOC True) |
| 13 |
|
| 14 |
include(GNUInstallDirs) |
| 15 |
|
| 16 |
set(NOTIFY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src) |
| 17 |
|
| 18 |
set(notify_SRCS |
| 19 |
${NOTIFY_PATH}/NotifyQueue.qml |
| 20 |
${NOTIFY_PATH}/Notification.qml |
| 21 |
${NOTIFY_PATH}/NotificationBase.qml |
| 22 |
${NOTIFY_PATH}/Notify.qml |
| 23 |
${NOTIFY_PATH}/NotifyConfiguration.qml |
| 24 |
${NOTIFY_PATH}/qmldir |
| 25 |
${CMAKE_CURRENT_SOURCE_DIR}/LICENSE |
| 26 |
) |
| 27 |
|
| 28 |
add_custom_target(NotifySrcs ALL SOURCES ${notify_SRCS}) |
| 29 |
|
| 30 |
if(DEFINED QT_IMPORTS_DIR) |
| 31 |
message(STATUS "Qt imports dir already set. Installing Notify to ${QT_IMPORTS_DIR}") |
| 32 |
else() |
| 33 |
find_package(Qt5Core REQUIRED) |
| 34 |
|
| 35 |
get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) |
| 36 |
execute_process( |
| 37 |
COMMAND ${QMAKE_EXECUTABLE} -query QT_INSTALL_QML |
| 38 |
OUTPUT_VARIABLE QT_IMPORTS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE |
| 39 |
) |
| 40 |
file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR) |
| 41 |
endif() |
| 42 |
|
| 43 |
install( |
| 44 |
FILES ${notify_SRCS} |
| 45 |
DESTINATION ${QT_IMPORTS_DIR}/Dekko/Notify |
| 46 |
) |
| 47 |
|
| 48 |
set(example_SRCS |
| 49 |
${CMAKE_CURRENT_SOURCE_DIR}/example/notify-example.qml |
| 50 |
${CMAKE_CURRENT_SOURCE_DIR}/example/CustomNotification.qml |
| 51 |
) |
| 52 |
|
| 53 |
add_custom_target(ExampleSrcs ALL SOURCES ${example_SRCS}) |
| 54 |
|
| 55 |
add_custom_target("run" /usr/bin/qmlscene ${CMAKE_SOURCE_DIR}/example/notify-example.qml) |
| 56 |
|
| 57 |
if(NOTIFY_TESTS) |
| 58 |
enable_testing() |
| 59 |
endif() |