bump year
[lxde/liblxqt.git] / CMakeLists.txt
index be54c58..e93abef 100644 (file)
@@ -1,24 +1,42 @@
-cmake_minimum_required(VERSION 2.8.9)
+cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
 
 project(liblxqt)
 
 set(LXQT_MAJOR_VERSION 0)
-set(LXQT_MINOR_VERSION 7)
+set(LXQT_MINOR_VERSION 10)
 set(LXQT_PATCH_VERSION 0)
 
-# Set default installation paths
-set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries")
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs) # Standard directories for installation
+
+#-----------------------------------------------------------------------------
+# LXQT_DATA_DIR defaults to CMAKE_INSTALL_FULL_DATADIR. It's added to
+#   XDG_DATA_DIRS by the startlxqt script
+# Warning: Setting LXQT_DATA_DIR must be done after including GNUInstallDirs
+#-----------------------------------------------------------------------------
+if (NOT DEFINED LXQT_DATA_DIR)
+    set(LXQT_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}" CACHE PATH
+        "LXQt base directory relative to which data files should be searched"
+    )
+endif()
+
+#-----------------------------------------------------------------------------
+# Release is the default build type
+#-----------------------------------------------------------------------------
+if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE Release)
+endif()
+
 set(LXQT_PKG_CONFIG_DESCRIPTION "Shared library for LXQt applications")
 
 set(PUB_HDRS
-    aboutdialog/lxqtaboutdialog.h
+    lxqthtmldelegate.h
     lxqtsettings.h
-    lxqtxfitman.h
     lxqtplugininfo.h
     lxqtpowermanager.h
-    addplugindialog/lxqtaddplugindialog.h
     lxqtscreensaver.h
     lxqtapplication.h
+    lxqtsingleapplication.h
     lxqttranslator.h
     lxqtprogramfinder.h
 
@@ -34,14 +52,13 @@ set(PUB_HDRS
 )
 
 set(PUBLIC_CLASSES
-    AboutDialog
+    HtmlDelegate
     Settings
-    XfitMan
     PluginInfo
     PowerManager
-    AddPluginDialog
     ScreenSaver
     Application
+    SingleApplication
     Translator
     ProgramFinder
 
@@ -55,22 +72,14 @@ set(PUBLIC_CLASSES
     RotatedWidget
 )
 
-set(PRIV_HDRS
-    aboutdialog/lxqtaboutdialog_p.h
-    aboutdialog/technicalinfo.h
-    translatorsinfo/translatorsinfo.h
-)
-
 set(SRCS
-    aboutdialog/lxqtaboutdialog.cpp
-    aboutdialog/technicalinfo.cpp
-    lxqtxfitman.cpp
+    lxqthtmldelegate.cpp
     lxqtplugininfo.cpp
     lxqtpowermanager.cpp
-    addplugindialog/lxqtaddplugindialog.cpp
     lxqtsettings.cpp
     lxqtscreensaver.cpp
     lxqtapplication.cpp
+    lxqtsingleapplication.cpp
     lxqttranslator.cpp
     lxqtprogramfinder.cpp
 
@@ -79,18 +88,15 @@ set(SRCS
 
     lxqtpower/lxqtpower.cpp
     lxqtpower/lxqtpowerproviders.cpp
-    lxqtnotification.cpp
     lxqtautostartentry.cpp
-    translatorsinfo/translatorsinfo.cpp
+    lxqtnotification.cpp
     lxqtgridlayout.cpp
     lxqtrotatedwidget.cpp
 )
 
 set(MOCS
-    aboutdialog/lxqtaboutdialog.h
-    aboutdialog/lxqtaboutdialog_p.h
+    lxqthtmldelegate.h
     lxqtpowermanager.h
-    addplugindialog/lxqtaddplugindialog.h
     lxqtsettings.h
     lxqtscreensaver.h
     lxqtapplication.h
@@ -107,108 +113,81 @@ set(MOCS
 )
 
 set(FORMS
-    aboutdialog/lxqtaboutdialog.ui
     configdialog/lxqtconfigdialog.ui
-    addplugindialog/lxqtaddplugindialog.ui
-)
-
-file(GLOB TS_FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/translations/liblxqt_*.ts
 )
 
 # additional cmake files
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-
-
-option(USE_QT5 "Force use the Qt5." $ENV{USE_QT5})
-option(USE_QT4 "Force use the Qt4." $ENV{USE_QT4})
-
-if((USE_QT4 AND USE_QT5) OR
-   (NOT USE_QT4 AND NOT USE_QT5))
+list(APPEND CMAKE_MODULE_PATH
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/find-modules"
+)
 
-    # Autodetect Qt version
-    find_package(Qt4 QUIET)
-    if (QT4_FOUND)
-        set(USE_QT4 ON)
-        set(USE_QT5 OFF)
-    else()
-        set(USE_QT4 OFF)
-        set(USE_QT5 ON)
-    endif()
-endif()
+option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
-if(USE_QT5)
-    set(CMAKE_AUTOMOC ON)
-    find_package(Qt5Widgets REQUIRED QUIET)
-    find_package(Qt5DBus REQUIRED QUIET)
-    find_package(Qt5X11Extras REQUIRED QUIET)
-    find_package(Qt5LinguistTools REQUIRED QUIET)
-    find_package(Qt5Xdg REQUIRED)
-    message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}")
-
-    QT5_WRAP_UI(UIS ${FORMS})
-    QT5_ADD_TRANSLATION(QM_FILES ${TS_FILES})
-    QT5_ADD_DBUS_INTERFACE(SRCS
-        dbus/org.freedesktop.Notifications.xml
-        notifications_interface
-    )
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
 
-    set(LXQT_QT_VERSION "5")
-    set(LXQT_PKG_CONFIG_REQUIRES "Qt5Widgets Qt5Xml Qt5DBus Qt5X11Extras")
-else()
-    find_package(Qt4 REQUIRED QtCore QtGui QUIET)
-    find_package(qtxdg REQUIRED)
-    message(STATUS "Building with Qt ${QTVERSION}")
-
-    include(${QT_USE_FILE})
-
-    QT4_WRAP_CPP(MOCS ${MOCS})
-    QT4_WRAP_UI(UIS ${FORMS})
-    QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES})
-    QT4_ADD_DBUS_INTERFACE(SRCS
-        dbus/org.freedesktop.Notifications.xml
-        notifications_interface
-    )
+find_package(Qt5Widgets REQUIRED QUIET)
+find_package(Qt5DBus REQUIRED QUIET)
+find_package(Qt5X11Extras REQUIRED QUIET)
+find_package(Qt5LinguistTools REQUIRED QUIET)
+find_package(Qt5Xdg REQUIRED QUIET)
+find_package(KF5WindowSystem REQUIRED QUIET)
+message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}")
 
-    set(LXQT_QT_VERSION "4")
-    set(LXQT_PKG_CONFIG_REQUIRES "QtCore, QtXml")
-endif()
+QT5_ADD_DBUS_INTERFACE(SRCS
+    dbus/org.freedesktop.Notifications.xml
+    notifications_interface
+)
 
-include(${QTXDG_USE_FILE})
+QT5_ADD_DBUS_ADAPTOR(SRCS
+    dbus/org.lxqt.SingleApplication.xml
+    lxqtsingleapplication.h LXQt::SingleApplication
+)
 
-find_package(X11 REQUIRED QUIET)
+set(LXQT_QT_VERSION "5")
 
-include_directories (
-    ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
-    ${X11_INCLUDE_DIR}
-    ${QTXDG_INCLUDE_DIRS}
-)
+# KF5WindowSystem is missing here. KF5WindowSystem doesn't provide an .pc file.
+set(LXQT_PKG_CONFIG_REQUIRES "Qt5Xdg >= 1.2.0, Qt5Widgets, Qt5Xml, Qt5DBus, Qt5X11Extras")
 
-if (NOT USE_QT5)
-    include_directories (
-        ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}
-    )
-endif()
 
 # Standard directories for installation
-include(GNUInstallDirs)
+include(LXQtCompilerSettings NO_POLICY_SCOPE)
+include(LXQtCreatePkgConfigFile)
+include(cmake/FindInstallConfigPath.cmake) # sets LXQT_ETC_XDG_DIR, if unset
+include(create_portable_headers)
 
 set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION})
-set(LXQT_LIBRARY_NAME "lxqt${LXQT_QT_VERSION}")
-set(LXQT_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/lxqt${LXQT_QT_VERSION})
-set(LXQT_TRANSLATIONS_DIR ${LXQT_SHARE_DIR}/translations)
-
-set(LXQT_INTREE_INCLUDE_DIR     ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
-set(LXQT_INTREE_TARGETS_FILE    ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-targets.cmake)
-
-set(LXQT_INSTALL_INCLUDE_DIR   ${CMAKE_INSTALL_FULL_INCLUDEDIR}/lxqt${LXQT_QT_VERSION})
-set(LXQT_INSTALL_CMAKE_DIR     ${CMAKE_INSTALL_PREFIX}/share/cmake)
-
-include(cmake/FindInstallConfigPath.cmake)
-include(create_portable_headers)
+set(LXQT_LIBRARY_NAME "lxqt" CACHE STRING "lxqt")
+set(LXQT_RELATIVE_SHARE_DIR "${LXQT_LIBRARY_NAME}")
+set(LXQT_SHARE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${LXQT_RELATIVE_SHARE_DIR}")
+set(LXQT_RELATIVE_TRANSLATIONS_DIR "${LXQT_LIBRARY_NAME}/translations")
+set(LXQT_TRANSLATIONS_DIR "${LXQT_SHARE_DIR}/translations")
+set(LXQT_GRAPHICS_DIR "${LXQT_SHARE_DIR}/graphics")
+
+set(LXQT_INTREE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include")
+set(LXQT_INTREE_TARGETS_FILE "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-targets.cmake")
+
+set(LXQT_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}")
+set(LXQT_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/cmake")
+
+
+## Translations
+include(LXQtTranslateTs)
+
+lxqt_translate_ts(QM_FILES
+    UPDATE_TRANSLATIONS
+        ${UPDATE_TRANSLATIONS}
+    SOURCES
+        ${SRCS}
+        ${FORMS}
+    INSTALL_DIR
+        "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
+)
 
 message(STATUS "")
 message(STATUS "liblxqt version: ${LXQT_VERSION}")
@@ -218,151 +197,179 @@ message(STATUS "")
 # Copy public headers
 foreach(h ${PUB_HDRS})
     get_filename_component(bh ${h} NAME)
-    configure_file(${h} ${LXQT_INTREE_INCLUDE_DIR}/LxQt/${bh} COPYONLY)
-    configure_file(${h} ${LXQT_INTREE_INCLUDE_DIR}/lxqt/${bh} COPYONLY)
+    configure_file(${h} "${LXQT_INTREE_INCLUDE_DIR}/LXQt/${bh}" COPYONLY)
 endforeach()
 
 # Create the portable headers
-create_portable_headers(INTREE_PORTABLE_HEADERS ${LXQT_INTREE_INCLUDE_DIR}/LxQt ${PUBLIC_CLASSES})
-check_portable_headers(H_FILES ${PUB_HDRS} LINKS ${INTREE_PORTABLE_HEADERS})
+create_portable_headers(INTREE_PORTABLE_HEADERS "${LXQT_INTREE_INCLUDE_DIR}/LXQt" ${PUBLIC_CLASSES})
+check_portable_headers(H_FILES ${PUB_HDRS} LINKS "${INTREE_PORTABLE_HEADERS}")
 
 #************************************************
 # Create in-tree build infrastructure
 #************************************************
-set(CFG_LXQT_INCLUDE_DIR    ${LXQT_INTREE_INCLUDE_DIR})
-set(CFG_LXQT_LIBRARY        ${LXQT_LIBRARY_NAME})
-set(CFG_LXQT_USE_FILE       ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}_use.cmake)
-set(CFG_LXQT_TARGETS_FILE   ${LXQT_INTREE_TARGETS_FILE})
-
-configure_file(
-    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqtX-config.cmake.in 
-    ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-config.cmake
-    @ONLY
-)
+set(CFG_LXQT_TARGETS_FILE   "${LXQT_INTREE_TARGETS_FILE}")
+set(CFG_LXQT_CMAKE_MODULES_DIR "${PROJECT_SOURCE_DIR}/cmake/modules")
+set(CFG_LXQT_CMAKE_FIND_MODULES_DIR "${PROJECT_SOURCE_DIR}/cmake/find-modules")
 
-configure_file(
-    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_use.cmake.in
-    ${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}_use.cmake
-    @ONLY
-)
-
-include(${CFG_LXQT_USE_FILE})
 
+configure_package_config_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in"
+    "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-config.cmake"
+    INSTALL_DESTINATION "neverland"     # required, altough we don't install it
+)
 
 #************************************************
-# Create instalable build infrastructure
+# Create installable build infrastructure
 #************************************************
-set(CFG_LXQT_INCLUDE_DIR    ${LXQT_INSTALL_INCLUDE_DIR})
-set(CFG_LXQT_LIBRARY        ${LXQT_LIBRARY_NAME})
-set(CFG_LXQT_USE_FILE       ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}_use.cmake)
-set(CFG_LXQT_TARGETS_FILE   ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}-targets.cmake)
-
-configure_file(
-    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqtX-config.cmake.in 
-    ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake
-    @ONLY
+set(CFG_LXQT_TARGETS_FILE "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/${LXQT_LIBRARY_NAME}-targets.cmake")
+set(CFG_LXQT_CMAKE_MODULES_DIR "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/modules")
+set(CFG_LXQT_CMAKE_FIND_MODULES_DIR "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/find-modules")
+
+configure_package_config_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt-config.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake"
+    INSTALL_DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}"
 )
 
-# use gcc visibility feature to decrease unnecessary exported symbols
-if (CMAKE_COMPILER_IS_GNUCXX)
-    # set visibility to hidden to hide symbols, unlesss they're exporeted
-    # manually in the code
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wl,-no-undefined -Wall")
-endif()
-add_definitions(-DCOMPILE_LIBLXQT)
-
-
-configure_file(
-    ${CMAKE_CURRENT_SOURCE_DIR}/cmake/lxqt_use.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}_use.cmake
-    @ONLY
+write_basic_package_version_file(
+    "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-config-version.cmake"
+    VERSION ${LXQT_VERSION}
+    COMPATIBILITY AnyNewerVersion
 )
 
-install(FILES 
-    ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake
-    ${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}_use.cmake
-    DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}
+install(FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/install/${LXQT_LIBRARY_NAME}-config.cmake"
+    "${CMAKE_BINARY_DIR}/${LXQT_LIBRARY_NAME}-config-version.cmake"
+    DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}"
     COMPONENT Devel
 )
 
-install(EXPORT 
+install(EXPORT
     ${LXQT_LIBRARY_NAME}-targets
-    DESTINATION ${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}
+    DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${LXQT_LIBRARY_NAME}"
     COMPONENT Devel
 )
 
+file(GLOB toInstallFindModules
+    "${PROJECT_SOURCE_DIR}/cmake/find-modules/*.cmake"
+)
 
-include(translatorsinfo/CMakeLists.txt)
-get_translatorsinfo_qrc(translatorsinfo_qrc)
-if(USE_QT5)
-    qt5_add_resources(QRC_CXX_SOURCES ${translatorsinfo_qrc})
-else()
-    qt4_add_resources(QRC_CXX_SOURCES ${translatorsinfo_qrc})
-endif()
+install(
+    FILES ${toInstallFindModules}
+    DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/find-modules"
+    COMPONENT Devel
+)
+
+file(GLOB toInstallModules
+    "${PROJECT_SOURCE_DIR}/cmake/modules/*.cmake"
+    "${PROJECT_SOURCE_DIR}/cmake/modules/*.in"
+)
+
+install(
+    FILES ${toInstallModules}
+    DESTINATION "${LXQT_INSTALL_CMAKE_DIR}/${LXQT_LIBRARY_NAME}/modules"
+    COMPONENT Devel
+)
 
 add_library(${LXQT_LIBRARY_NAME}
     SHARED ${PUB_HDRS}
-           ${PRIV_HDRS}
            ${SRCS}
            ${dbus_generated}
            ${UIS} ${MOCS}
            ${QM_FILES}
            ${QRC_CXX_SOURCES}
-           
+
 )
 
-if (USE_QT5)
-       qt5_use_modules(${LXQT_LIBRARY_NAME} Widgets DBus X11Extras)
-    target_link_libraries(${LXQT_LIBRARY_NAME}
-        ${X11_X11_LIB}
-        ${QTXDG_LIBRARIES}
-    )
-else()
-    target_link_libraries(${LXQT_LIBRARY_NAME}
-        ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
-        ${QT_QTDBUS_LIBRARY}
-        ${X11_X11_LIB}
-        ${QTXDG_LIBRARIES}
-    )
-endif()
+target_link_libraries(${LXQT_LIBRARY_NAME}
+    PUBLIC
+        KF5::WindowSystem
+        Qt5::Widgets
+        Qt5::DBus
+        Qt5::X11Extras
+        Qt5Xdg
+)
 
 set_target_properties(${LXQT_LIBRARY_NAME} PROPERTIES
     VERSION   ${LXQT_VERSION}
     SOVERSION ${LXQT_MAJOR_VERSION}
 )
 
-install(TARGETS 
-    ${LXQT_LIBRARY_NAME} 
-    DESTINATION ${CMAKE_INSTALL_LIBDIR} 
-    EXPORT ${LXQT_LIBRARY_NAME}-targets
-    LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
+target_compile_definitions(${LXQT_LIBRARY_NAME}
+    PRIVATE "LXQT_RELATIVE_SHARE_DIR=\"${LXQT_RELATIVE_SHARE_DIR}\""
+    PRIVATE "LXQT_SHARE_DIR=\"${LXQT_SHARE_DIR}\""
+    PRIVATE "LXQT_RELATIVE_SHARE_TRANSLATIONS_DIR=\"${LXQT_RELATIVE_TRANSLATIONS_DIR}\""
+    PRIVATE "LXQT_SHARE_TRANSLATIONS_DIR=\"${LXQT_TRANSLATIONS_DIR}\""
+    PRIVATE "LXQT_GRAPHICS_DIR=\"${LXQT_GRAPHICS_DIR}\""
+    PRIVATE "LXQT_ETC_XDG_DIR=\"${LXQT_ETC_XDG_DIR}\""
+    PRIVATE "LXQT_DATA_DIR=\"${LXQT_DATA_DIR}\""
+    PRIVATE "LXQT_VERSION=\"${LXQT_VERSION}\""
+    PRIVATE "COMPILE_LIBLXQT"
 )
 
+target_compile_definitions(${LXQT_LIBRARY_NAME}
+    PRIVATE "$<$<CONFIG:Release>:QT_NO_DEBUG_OUTPUT>"
+    PRIVATE "$<$<CONFIG:Release>:QT_NO_WARNING_OUTPUT>"
+)
 
-export(TARGETS ${LXQT_LIBRARY_NAME} ${QTXDG_TARGET} FILE ${LXQT_INTREE_TARGETS_FILE})
+target_include_directories(${LXQT_LIBRARY_NAME}
+    INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}>"
+    INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LXQT_LIBRARY_NAME}/LXQt>"
+)
 
-install(FILES ${PUB_HDRS}                DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/LXQt)
-install(FILES ${INTREE_PORTABLE_HEADERS} DESTINATION ${LXQT_INSTALL_INCLUDE_DIR}/LXQt)
+target_include_directories(${LXQT_LIBRARY_NAME}
+    INTERFACE "$<BUILD_INTERFACE:${LXQT_INTREE_INCLUDE_DIR}>"
+    INTERFACE "$<BUILD_INTERFACE:${LXQT_INTREE_INCLUDE_DIR}/LXQt>"
+)
 
-install(FILES ${QM_FILES} DESTINATION ${LXQT_TRANSLATIONS_DIR})
+install(TARGETS
+    ${LXQT_LIBRARY_NAME}
+    DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    EXPORT ${LXQT_LIBRARY_NAME}-targets
+    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+    COMPONENT Runtime
+)
+
+export(TARGETS ${LXQT_LIBRARY_NAME}
+    APPEND FILE "${LXQT_INTREE_TARGETS_FILE}"
+    EXPORT_LINK_INTERFACE_LIBRARIES
+)
+
+install(FILES
+    ${PUB_HDRS}
+    DESTINATION "${LXQT_INSTALL_INCLUDE_DIR}/LXQt"
+    COMPONENT Devel
+)
+
+install(FILES
+    ${INTREE_PORTABLE_HEADERS}
+    DESTINATION "${LXQT_INSTALL_INCLUDE_DIR}/LXQt"
+    COMPONENT Devel
+)
 
 #************************************************
-# Create pkgconfig file
+# Create and install pkgconfig file
 #************************************************
-lxqt_create_pkgconfig_file(${LXQT_LIBRARY_NAME}
-    ${LXQT_PKG_CONFIG_DESCRIPTION}
-    ${LXQT_PKG_CONFIG_REQUIRES}
-    ${LXQT_LIBRARY_NAME}
-    ${LXQT_VERSION}
+lxqt_create_pkgconfig_file(
+    PACKAGE_NAME ${LXQT_LIBRARY_NAME}
+    DESCRIPTIVE_NAME ${LXQT_LIBRARY_NAME}
+    DESCRIPTION ${LXQT_PKG_CONFIG_DESCRIPTION}
+    INCLUDEDIRS ${LXQT_LIBRARY_NAME}
+    LIBS ${LXQT_LIBRARY_NAME}
+    REQUIRES ${LXQT_PKG_CONFIG_REQUIRES}
+    VERSION ${LXQT_VERSION}
+    INSTALL
 )
 #************************************************
 
+
 # building tarball with CPack -------------------------------------------------
-include (InstallRequiredSystemLibraries)
-set (CPACK_PACKAGE_VERSION_MAJOR ${LXQT_MAJOR_VERSION})
-set (CPACK_PACKAGE_VERSION_MINOR ${LXQT_MINOR_VERSION})
-set (CPACK_PACKAGE_VERSION_PATCH ${LXQT_PATCH_VERSION})
-set (CPACK_GENERATOR TBZ2)
-set (CPACK_SOURCE_GENERATOR TBZ2)
-set (CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
-include (CPack)
+include(InstallRequiredSystemLibraries)
+set(CPACK_PACKAGE_VERSION_MAJOR ${LXQT_MAJOR_VERSION})
+set(CPACK_PACKAGE_VERSION_MINOR ${LXQT_MINOR_VERSION})
+set(CPACK_PACKAGE_VERSION_PATCH ${LXQT_PATCH_VERSION})
+set(CPACK_GENERATOR TBZ2)
+set(CPACK_SOURCE_GENERATOR TBZ2)
+set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp)
+include(CPack)
+