# - Find the LXQt include and library dirs and define a some macros # # The module defines the following functions # # lxqt_set_default_value(VAR_NAME VAR_VALUE) # # # lxqt_create_pkgconfig_file(name # desc # requires # include_rel_dir # version) # Write a pkg-config pc file for given "name" with "decription" # Arguments: # name: a library name (withoud "lib" prefix and "so" suffixes # desc: a desription string # requires: required libraries # include_rel_dir: include directory, relative to includedir # version: package version # # # # The module defines the following definitions # # -DLXQT_SHARE_DIR - This allows to install and read the configs from non-standard locations # # -DLXQT_ETC_XDG_DIR - 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 Qt4's qmake: # qmake -query QT_INSTALL_CONFIGURATION # # # include_directories(${LXQT_INCLUDE_DIRS}) link_directories(${LXQT_LIBRARY_DIRS}) add_definitions(-DLXQT_RELATIVE_SHARE_DIR=\"${LXQT_RELATIVE_SHARE_DIR}\") add_definitions(-DLXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\") add_definitions(-DLXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\") add_definitions(-DLXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\") add_definitions(-DLXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\") add_definitions(-DLXQT_VERSION=\"${LXQT_VERSION}\") SET_SOURCE_FILES_PROPERTIES(LXQT_LIBRARIES PROPERTIES OBJECT_DEPENDS lxqt${LXQT_QT_VERSION}) if (LXQT_QT_VERSION EQUAL "4") find_package(Qt4 REQUIRED QUIET) include(${QT_USE_FILE}) find_package(QTXDG REQUIRED) elseif(LXQT_QT_VERSION EQUAL "5") find_package(Qt5Widgets REQUIRED QUIET) find_package(Qt5DBus REQUIRED QUIET) find_package(Qt5X11Extras REQUIRED QUIET) find_package(Qt5LinguistTools REQUIRED QUIET) find_package(Qt5Xdg REQUIRED) find_package(KF5WindowSystem REQUIRED QUIET) else() message(FATAL "Qt${LXQT_QT_VERSION} is not supported.") endif() list(APPEND CMAKE_MODULE_PATH ${LXQT_CMAKE_MODULES_DIR}) # Works for Qt4 and Qt5 include(${QTXDG_USE_FILE}) macro(lxqt_set_default_value VAR_NAME VAR_VALUE) if (NOT DEFINED ${VAR_NAME}) set (${VAR_NAME} ${VAR_VALUE}) endif () endmacro() # # Write a pkg-config pc file for given "name" with "decription" # Arguments: # name: a library name (withoud "lib" prefix and "so" suffixes # desc: a desription string # macro(lxqt_create_pkgconfig_file name desc requires include_rel_dir version) set(_pkgfname "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc") message(STATUS "${name}: writing pkgconfig file ${_pkgfname}") file(WRITE "${_pkgfname}" "# file generated by razor-qt cmake build\n" "prefix=${CMAKE_INSTALL_PREFIX}\n" "libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR}\n" "includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}\n" "\n" "Name: ${name}\n" "Description: ${desc}\n" "Version: ${version}\n" "Requires: ${requires}\n" "Libs: -L\${libdir} -l${name}\n" "Cflags: -I\${includedir} -I\${includedir}/${include_rel_dir}\n" "\n" ) install(FILES ${_pkgfname} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endmacro()