diff options
author | Aleix Pol <aleixpol@kde.org> | 2017-12-12 16:34:39 +0100 |
---|---|---|
committer | Aleix Pol <aleixpol@kde.org> | 2017-12-15 16:39:57 +0100 |
commit | 24134c972e375bebad45c860c413233b60863852 (patch) | |
tree | d0c2d8011c39742704feb8f6ed63dae9b0a33722 | |
parent | d4449ad80a1902dccfb8116c88c321af2be44238 (diff) | |
download | extra-cmake-modules-24134c972e375bebad45c860c413233b60863852.tar.gz extra-cmake-modules-24134c972e375bebad45c860c413233b60863852.tar.bz2 |
Introduce INSTALL_PREFIX_SCRIPT to easily set up prefixes
Summary:
If enabled it will install a prefix.sh script to the root of the prefix.
This file will be useful to be able to easily set up a prefix to be used by
integrating the environment variables it exports.
Test Plan:
```
$ cat prefix.sh
export PATH=/home/apol/devel/kde5/bin:$PATH
export LD_LIBRARY_PATH=/home/apol/devel/kde5/lib64:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=/home/apol/devel/kde5/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}
export XDG_CONFIG_DIRS=/home/apol/devel/kde5/etc/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}
export QT_PLUGIN_PATH=/home/apol/devel/kde5/lib64/plugins:$QT_PLUGIN_PATH
export QML2_IMPORT_PATH=/home/apol/devel/kde5/lib64/qml:$QML2_IMPORT_PATH
```
Reviewers: #frameworks, sitter
Reviewed By: sitter
Subscribers: kfunk, bcooksley, ngraham, sitter, cgiboudeaux, #build_system
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D9299
-rw-r--r-- | kde-modules/KDEInstallDirs.cmake | 16 | ||||
-rw-r--r-- | kde-modules/prefix.sh.cmake | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake index b0e651f6..5c8783b5 100644 --- a/kde-modules/KDEInstallDirs.cmake +++ b/kde-modules/KDEInstallDirs.cmake @@ -190,6 +190,11 @@ # # NB: The variables starting ``KDE_INSTALL_`` are available since 1.6.0, # unless otherwise noted with the variable. +# +# The ``KDE_INSTALL_PREFIX_SCRIPT`` option will install a ${CMAKE_INSTALL_PREFIX}/prefix.sh +# file that allows to easily incorporate the necessary environment variables +# for the prefix into a process. +# #============================================================================= # Copyright 2014-2015 Alex Merry <alex.merry@kde.org> @@ -689,3 +694,14 @@ endif() if(NOT "${PROJECT_NAME}" STREQUAL "Project") set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "${PROJECT_NAME}") endif() + + +################################################################### +# Prefix set up + +configure_file(${CMAKE_CURRENT_LIST_DIR}/prefix.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/prefix.sh @ONLY) + +option(KDE_INSTALL_PREFIX_SCRIPT "Installs ${CMAKE_INSTALL_PREFIX}/prefix.sh that sets up the necessary environment variables" OFF) +if(KDE_INSTALL_PREFIX_SCRIPT) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/prefix.sh DESTINATION ${CMAKE_INSTALL_PREFIX} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) +endif() diff --git a/kde-modules/prefix.sh.cmake b/kde-modules/prefix.sh.cmake new file mode 100644 index 00000000..bddebeb5 --- /dev/null +++ b/kde-modules/prefix.sh.cmake @@ -0,0 +1,8 @@ +export PATH=@KDE_INSTALL_FULL_BINDIR@:$PATH +export LD_LIBRARY_PATH=@KDE_INSTALL_FULL_LIBDIR@:$LD_LIBRARY_PATH + +export XDG_DATA_DIRS=@KDE_INSTALL_FULL_DATADIR@:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} +export XDG_CONFIG_DIRS=@KDE_INSTALL_FULL_CONFDIR@:${XDG_CONFIG_DIRS:-/etc/xdg} + +export QT_PLUGIN_PATH=@KDE_INSTALL_FULL_QTPLUGINDIR@:$QT_PLUGIN_PATH +export QML2_IMPORT_PATH=@KDE_INSTALL_FULL_QMLDIR@:$QML2_IMPORT_PATH |