File: FindInstallConfigPath.cmake

package info (click to toggle)
lxqt-build-tools 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: perl: 42; sh: 14; makefile: 6
file content (35 lines) | stat: -rw-r--r-- 1,540 bytes parent folder | download | duplicates (2)
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
# XDG standards expects system-wide configuration files in the /etc/xdg/lxqt location.
# Unfortunately QSettings we are using internally can be overriden in the Qt compilation
# time to use different path for system-wide configs. (for example configure ... -sysconfdir /etc/settings ...)
# This path can be found calling Qt qmake:
#   qtpaths --query QT_INSTALL_CONFIGURATION
#

find_package(Qt6 ${LXQTBT_QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6CoreTools ${LXQTBT_QT_MINIMUM_VERSION} REQUIRED)

macro(print_set_lxqt_etc_xdg_dir_info)
    message(STATUS "You can set it manually with -DLXQT_ETC_XDG_DIR=<value>")
    message(STATUS "")
endmacro()

include(${PROJECT_SOURCE_DIR}/cmake/modules/LXQtQueryQt.cmake)

if(NOT DEFINED LXQT_ETC_XDG_DIR)
    set(qt_variable "QT_INSTALL_CONFIGURATION")
    lxqt_query_qt(output_path ${qt_variable} IGNORE_ERRORS)
    if (output_path STREQUAL "")
        set(output_path "/etc/xdg")
        set(LXQT_ETC_XDG_DIR ${output_path}
            CACHE FILEPATH "Location of the LXQt XDG system-wide configuration files")
        message(STATUS "Got nothing from: ${QUERY_EXECUTABLE} --query \"${qt_variable}\"")
        message(STATUS "Unable to autodetect LXQT_ETC_XDG_DIR. LXQT_ETC_XDG_DIR will be set to '/etc/xdg'")
    else()
        set(LXQT_ETC_XDG_DIR ${output_path}
            CACHE FILEPATH "Location of the LXQt XDG system-wide configuration files")
        message(STATUS "LXQT_ETC_XDG_DIR autodetected as '${LXQT_ETC_XDG_DIR}'")
    endif()

    print_set_lxqt_etc_xdg_dir_info()
endif()