diff options
| -rw-r--r-- | CMakeLists.txt | 12 | ||||
| -rw-r--r-- | extra-cmake-modules-config.cmake.in | 4 | ||||
| -rw-r--r-- | kde-modules/KDEInstallDirs.cmake | 179 | 
3 files changed, 190 insertions, 5 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index 13fa6a4e..ff9bc317 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(extra-cmake-modules)  set(ECM_MAJOR_VERSION 0)  set(ECM_MINOR_VERSION 0) -set(ECM_PATCH_VERSION 2) +set(ECM_PATCH_VERSION 3)  set(ECM_VERSION ${ECM_MAJOR_VERSION}.${ECM_MINOR_VERSION}.${ECM_PATCH_VERSION}) @@ -13,15 +13,16 @@ add_subdirectory(tests)  set(SHARE_INSTALL_DIR share/extra-cmake-modules-${ECM_VERSION})  set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/modules/) +set(KDE_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/kde-modules/)  set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/find-modules/)  set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/cmake/)  set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/)  # create and install docs  add_custom_target(ManPage ALL -                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.1" -                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.html" -                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.txt" +                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules\;${CMAKE_SOURCE_DIR}/kde-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.1" +                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules\;${CMAKE_SOURCE_DIR}/kde-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.html" +                    COMMAND ${CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/modules\;${CMAKE_SOURCE_DIR}/find-modules\;${CMAKE_SOURCE_DIR}/kde-modules --help-custom-modules "${CMAKE_BINARY_DIR}/extra-cmake-modules.txt"                      VERBATIM                   ) @@ -34,6 +35,9 @@ install(FILES "${CMAKE_BINARY_DIR}/extra-cmake-modules.txt" "${CMAKE_BINARY_DIR}  file(GLOB installModuleFiles ${CMAKE_SOURCE_DIR}/modules/*[^~])  install(FILES ${installModuleFiles} DESTINATION ${MODULES_INSTALL_DIR}) +file(GLOB installKdeModuleFiles ${CMAKE_SOURCE_DIR}/kde-modules/*[^~]) +install(FILES ${installKdeModuleFiles} DESTINATION ${KDE_MODULES_INSTALL_DIR}) +  file(GLOB installFindModuleFiles ${CMAKE_SOURCE_DIR}/find-modules/*[^~])  install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR}) diff --git a/extra-cmake-modules-config.cmake.in b/extra-cmake-modules-config.cmake.in index 0906ac12..33ae10d8 100644 --- a/extra-cmake-modules-config.cmake.in +++ b/extra-cmake-modules-config.cmake.in @@ -11,6 +11,8 @@ set(EXTRA_CMAKE_MODULES_FIND_MODULE_DIR "${rootDir}/@FIND_MODULES_INSTALL_DIR@")  set(EXTRA_CMAKE_MODULES_MODULE_DIR "${rootDir}/@MODULES_INSTALL_DIR@") -set(EXTRA_CMAKE_MODULES_MODULE_PATH "${EXTRA_CMAKE_MODULES_MODULE_DIR}" "${EXTRA_CMAKE_MODULES_FIND_MODULE_DIR}") +set(EXTRA_CMAKE_MODULES_KDE_MODULE_DIR "${rootDir}/@KDE_MODULES_INSTALL_DIR@") + +set(EXTRA_CMAKE_MODULES_MODULE_PATH "${EXTRA_CMAKE_MODULES_MODULE_DIR}" "${EXTRA_CMAKE_MODULES_FIND_MODULE_DIR}" "${EXTRA_CMAKE_MODULES_KDE_MODULE_DIR}")  include("${EXTRA_CMAKE_MODULES_MODULE_DIR}/ECMUseFindModules.cmake") diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake new file mode 100644 index 00000000..45dd6877 --- /dev/null +++ b/kde-modules/KDEInstallDirs.cmake @@ -0,0 +1,179 @@ +# This module defines also a bunch of variables used as locations for install directories +# for files of the package which is using this module. These variables don't say +# anything about the location of the installed KDE. +# They can be relative (to CMAKE_INSTALL_PREFIX) or absolute. +# Under Windows they are always relative. +# +#  BIN_INSTALL_DIR          - the directory where executables will be installed (default is prefix/bin) +#  BUNDLE_INSTALL_DIR       - Mac only: the directory where application bundles will be installed (default is /Applications/KDE4 ) +#  SBIN_INSTALL_DIR         - the directory where system executables will be installed (default is prefix/sbin) +#  LIB_INSTALL_DIR          - the directory where libraries will be installed (default is prefix/lib) +#  CONFIG_INSTALL_DIR       - the directory where config files will be installed +#  DATA_INSTALL_DIR         - the parent directory where applications can install their data +#  HTML_INSTALL_DIR         - the directory where HTML documentation will be installed +#  ICON_INSTALL_DIR         - the directory where the icons will be installed (default prefix/share/icons/) +#  INFO_INSTALL_DIR         - the directory where info files will be installed (default prefix/info) +#  KCFG_INSTALL_DIR         - the directory where kconfig files will be installed +#  LOCALE_INSTALL_DIR       - the directory where translations will be installed +#  MAN_INSTALL_DIR          - the directory where man pages will be installed (default prefix/man/) +#  MIME_INSTALL_DIR         - the directory where mimetype desktop files will be installed +#  PLUGIN_INSTALL_DIR       - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4) +#  IMPORTS_INSTALL_DIR      - the subdirectory relative to the install prefix where imports will be installed +#  SERVICES_INSTALL_DIR     - the directory where service (desktop, protocol, ...) files will be installed +#  SERVICETYPES_INSTALL_DIR - the directory where servicestypes desktop files will be installed +#  SOUND_INSTALL_DIR        - the directory where sound files will be installed +#  TEMPLATES_INSTALL_DIR    - the directory where templates (Create new file...) will be installed +#  WALLPAPER_INSTALL_DIR    - the directory where wallpapers will be installed +#  AUTOSTART_INSTALL_DIR    - the directory where autostart files will be installed +#  DEMO_INSTALL_DIR         - the directory where demos will be installed +#  KCONF_UPDATE_INSTALL_DIR - the directory where kconf_update files will be installed +#  SYSCONF_INSTALL_DIR      - the directory where sysconfig files will be installed (default /etc) +#  XDG_APPS_INSTALL_DIR     - the XDG apps dir +#  XDG_DIRECTORY_INSTALL_DIR- the XDG directory +#  XDG_MIME_INSTALL_DIR     - the XDG mimetypes install dir +#  DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces will be installed (default is prefix/share/dbus-1/interfaces) +#  DBUS_SERVICES_INSTALL_DIR        - the directory where dbus services will be installed (default is prefix/share/dbus-1/services ) +#  DBUS_SYSTEM_SERVICES_INSTALL_DIR        - the directory where dbus system services will be installed (default is prefix/share/dbus-1/system-services ) +# +# The variable INSTALL_TARGETS_DEFAULT_ARGS can be used when installing libraries +# or executables into the default locations. +# The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries are installed. +# It should also be used when installing applications, since then +# on OS X application bundles will be installed to BUNDLE_INSTALL_DIR. +# The variable MUST NOT be used for installing plugins. +# It also MUST NOT be used for executables which are intended to go into sbin/ or libexec/. +# +# Usage is like this: +#    install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} ) +# +# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go +# into bin/. + + + +# Figure out what the default install directory for libraries should be. +# This is the same logic as in cmake's GNUInstallDirs.cmake. +set(_LIBDIR_DEFAULT "lib") +# Override this default 'lib' with 'lib64' iff: +#  - we are on Linux system but NOT cross-compiling +#  - we are NOT on debian +#  - we are on a 64 bits system +# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf +# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if +# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu" +# See http://wiki.debian.org/Multiarch +if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CROSSCOMPILING) +  if (EXISTS "/etc/debian_version") # is this a debian system ? +      if(CMAKE_LIBRARY_ARCHITECTURE) +        set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}") +      endif() +  else() # not debian, rely on CMAKE_SIZEOF_VOID_P: +    if(NOT DEFINED CMAKE_SIZEOF_VOID_P) +      message(AUTHOR_WARNING +        "Unable to determine default LIB_INSTALL_LIBDIR directory because no target architecture is known. " +        "Please enable at least one language before including KDEInstallDirs.") +    else() +      if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") +        set(_LIBDIR_DEFAULT "lib64") +      endif() +    endif() +  endif() +endif() + + +# This macro implements some very special logic how to deal with the cache. +# By default the various install locations inherit their value from their "parent" variable +# so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will +# calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX . +# This would work completely without using the cache. +# But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into +# the cache, otherwise it will be forgotten on the next cmake run. +# Once a variable is in the cache, it doesn't depend on its "parent" variables +# anymore and you can only change it by editing it directly. +# this macro helps in this regard, because as long as you don't set one of the +# variables explicitely to some location, it will always calculate its value from its +# parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. +# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location +# this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. +# +# additionally if installing to the same location as kdelibs, the other install +# directories are reused from the installed kdelibs +macro(_SET_FANCY _var _value _comment) +  set(_predefinedvalue "${_value}") +  if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "${KDE4_INSTALL_DIR}" AND DEFINED KDE4_${_var}) +      set(_predefinedvalue "${KDE4_${_var}}") +  endif() + +  if (NOT DEFINED ${_var}) +      set(${_var} ${_predefinedvalue}) +  else() +      set(${_var} "${${_var}}" CACHE STRING "${_comment}") +  endif() +endmacro(_SET_FANCY) + + +if(APPLE) +  set(BUNDLE_INSTALL_DIR             "/Applications/KDE4" CACHE PATH               "Directory where application bundles will be installed to on OSX" ) +endif(APPLE) + +_set_fancy(EXEC_INSTALL_PREFIX       ""                                            "Base directory for executables and libraries") +_set_fancy(SHARE_INSTALL_PREFIX      "share"                                       "Base directory for files which go to share/") + +_set_fancy(BIN_INSTALL_DIR           "${EXEC_INSTALL_PREFIX}bin"                   "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") +_set_fancy(SBIN_INSTALL_DIR          "${EXEC_INSTALL_PREFIX}sbin"                  "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") +_set_fancy(LIB_INSTALL_DIR           "${EXEC_INSTALL_PREFIX}${_LIBDIR_DEFAULT}"    "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib[64], Debian multiarch is taken into account)") +if(WIN32) +  _set_fancy(LIBEXEC_INSTALL_DIR     "${BIN_INSTALL_DIR}"                          "The install dir for libexec executables (default is ${LIB_INSTALL_DIR}/kde4/libexec)") +else() +  _set_fancy(LIBEXEC_INSTALL_DIR     "${LIB_INSTALL_DIR}/kde4/libexec"             "The install dir for libexec executables (default is ${LIB_INSTALL_DIR}/kde4/libexec)") +endif() +_set_fancy(INCLUDE_INSTALL_DIR       "include"                                     "The install dir for header files") + +_set_fancy(PLUGIN_INSTALL_DIR        "${LIB_INSTALL_DIR}/kde4"                     "The install dir where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") +_set_fancy(IMPORTS_INSTALL_DIR       "${PLUGIN_INSTALL_DIR}/imports"               "The install dir where imports will be installed") +_set_fancy(CONFIG_INSTALL_DIR        "${SHARE_INSTALL_PREFIX}/config"              "The config file install dir") +_set_fancy(DATA_INSTALL_DIR          "${SHARE_INSTALL_PREFIX}/apps"                "The parent directory where applications can install their data") +_set_fancy(HTML_INSTALL_DIR          "${SHARE_INSTALL_PREFIX}/doc/HTML"            "The HTML install dir for documentation") +_set_fancy(ICON_INSTALL_DIR          "${SHARE_INSTALL_PREFIX}/icons"               "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") +_set_fancy(KCFG_INSTALL_DIR          "${SHARE_INSTALL_PREFIX}/config.kcfg"         "The install dir for kconfig files") +_set_fancy(LOCALE_INSTALL_DIR        "${SHARE_INSTALL_PREFIX}/locale"              "The install dir for translations") +_set_fancy(SERVICES_INSTALL_DIR      "${SHARE_INSTALL_PREFIX}/kde4/services"       "The install dir for service (desktop, protocol, ...) files") +_set_fancy(SERVICETYPES_INSTALL_DIR  "${SHARE_INSTALL_PREFIX}/kde4/servicetypes"   "The install dir for servicestypes desktop files") +_set_fancy(SOUND_INSTALL_DIR         "${SHARE_INSTALL_PREFIX}/sounds"              "The install dir for sound files") +_set_fancy(TEMPLATES_INSTALL_DIR     "${SHARE_INSTALL_PREFIX}/templates"           "The install dir for templates (Create new file...)") +_set_fancy(WALLPAPER_INSTALL_DIR     "${SHARE_INSTALL_PREFIX}/wallpapers"          "The install dir for wallpapers") +_set_fancy(KCONF_UPDATE_INSTALL_DIR  "${DATA_INSTALL_DIR}/kconf_update"            "The kconf_update install dir") +_set_fancy(AUTOSTART_INSTALL_DIR     "${SHARE_INSTALL_PREFIX}/autostart"           "The install dir for autostart files") + +_set_fancy(XDG_APPS_INSTALL_DIR      "${SHARE_INSTALL_PREFIX}/applications/kde4"   "The XDG apps dir") +_set_fancy(XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") +_set_fancy(XDG_MIME_INSTALL_DIR      "${SHARE_INSTALL_PREFIX}/mime/packages"       "The install dir for the xdg mimetypes") + +_set_fancy(SYSCONF_INSTALL_DIR       "etc"                                         "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)") +_set_fancy(MAN_INSTALL_DIR           "${SHARE_INSTALL_PREFIX}/man"                 "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)") + +_set_fancy(DBUS_INTERFACES_INSTALL_DIR      "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces"      "The dbus interfaces install dir (default  ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") +_set_fancy(DBUS_SERVICES_INSTALL_DIR        "${SHARE_INSTALL_PREFIX}/dbus-1/services"        "The dbus services install dir (default  ${SHARE_INSTALL_PREFIX}/dbus-1/services)") +_set_fancy(DBUS_SYSTEM_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/system-services" "The dbus system services install dir (default  ${SHARE_INSTALL_PREFIX}/dbus-1/system-services)") + + + +# For more documentation see above. +# Later on it will be possible to extend this for installing OSX frameworks +# The COMPONENT Devel argument has the effect that static libraries belong to the +# "Devel" install component. If we use this also for all install() commands +# for header files, it will be possible to install +#   -everything: make install OR cmake -P cmake_install.cmake +#   -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake +#   -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake +# This can then also be used for packaging with cpack. +set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${BIN_INSTALL_DIR}" +                                  LIBRARY DESTINATION "${LIB_INSTALL_DIR}" +                                  ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) + + +# on the Mac support an extra install directory for application bundles +if(APPLE) +  set(INSTALL_TARGETS_DEFAULT_ARGS  ${INSTALL_TARGETS_DEFAULT_ARGS} +                                    BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) +endif(APPLE) | 
