diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-10-30 10:00:18 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-10-30 10:00:18 +0100 |
commit | 7628889ebfa230df48a338185b16ab5f64e7e16c (patch) | |
tree | d40761cf57cd7ad0468c27d5d8eabf885066ab82 | |
parent | 245b50e7e976fe7620d08b1dc16ef98f10bb4e32 (diff) | |
download | ufo-filters-7628889ebfa230df48a338185b16ab5f64e7e16c.tar.gz ufo-filters-7628889ebfa230df48a338185b16ab5f64e7e16c.tar.bz2 ufo-filters-7628889ebfa230df48a338185b16ab5f64e7e16c.tar.xz ufo-filters-7628889ebfa230df48a338185b16ab5f64e7e16c.zip |
Use ConfigurePaths for installation
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | common/cmake/ConfigurePaths.cmake | 90 | ||||
-rw-r--r-- | src/CMakeLists.txt | 9 |
3 files changed, 98 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a197cdb..dbfc0ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ set(UFO_DESCRIPTION_SUMMARY "UFO good filters") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/common/cmake") #{{{ Variables and Options +include(ConfigurePaths) +configure_paths(UFO_FILTERS) + +set(UFO_FILTERS_PLUGINDIR "${UFO_FILTERS_LIBDIR}/ufo") set(PKG_UFO_CORE_MIN_REQUIRED "0.5") option(WITH_PROFILING "Enable profiling" OFF) diff --git a/common/cmake/ConfigurePaths.cmake b/common/cmake/ConfigurePaths.cmake new file mode 100644 index 0000000..df9c03c --- /dev/null +++ b/common/cmake/ConfigurePaths.cmake @@ -0,0 +1,90 @@ +# - pre-configured paths for CMake +# +# Usage: +# configure_paths(<PREFIX>) +# +# Checks if configure-like prefix and installation paths were passed by the user +# and sets up corresponding variables for use in install() commands and to fill +# out .pc files: +# +# PREFIX_PREFIX defaults to ... CMAKE_INSTALL_PREFIX +# PREFIX_EPREFIX PREFIX_PREFIX +# PREFIX_SBINDIR PREFIX_EPREFIX/sbin +# PREFIX_SYSCONFDIR PREFIX_PREFIX/etc +# PREFIX_LOCALSTATEDIR PREFIX_PREFIX/var +# PREFIX_BINDIR PREFIX_EPREFIX/bin +# PREFIX_LIBDIR PREFIX_EPREFIX/lib +# PREFIX_INCLUDEDIR PREFIX_PREFIX/include +# PREFIX_PKGCONFIGDIR PREFIX_LIBDIR/pkgconfig +# PREFIX_TYPELIBDIR PREFIX_LIBDIR/girepository-1.0 +# PREFIX_DATAROOTDIR PREFIX_PREFIX/share +# PREFIX_DATADIR PREFIX_DATAROOTDIR +# PREFIX_INFODIR PREFIX_DATAROOTDIR/info +# PREFIX_MANDIR PREFIX_DATAROOTDIR/man +# PREFIX_LOCALEDIR PREFIX_DATAROOTDIR/locale +# PREFIX_GIRDIR PREFIX_DATAROOTDIR/gir-1.0 + +# Copyright (C) 2013 Matthias Vogelgesang <matthias.vogelgesang@gmail.com> +# +# Redistribution and use, with or without modification, are permitted +# provided that the following conditions are met: +# +# 1. Redistributions must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# 2. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +if(__configure_paths) + return() +endif() + +set(__configure_paths YES) + +macro(_set_var _prefix _var _user _override _description) + set(_name "${_prefix}_${_var}") + + set("${_name}" "${_user}") + + if("${_name}" STREQUAL "") + set("${_name}" "${_override}") + endif() + + set(${_name} "${${_name}}" CACHE PATH "${_description}") + mark_as_advanced(${_name}) +endmacro() + +function(configure_paths _prefix) + _set_var("${_prefix}" "PREFIX" "${PREFIX}" "${CMAKE_INSTALL_PREFIX}" "install architecture-independent files in PREFIX") + _set_var("${_prefix}" "EPREFIX" "${EXEC_PREFIX}" "${${_prefix}_PREFIX}" "install architecture-dependent files in EPREFIX") + + _set_var("${_prefix}" "SBINDIR" "${SBINDIR}" "${${_prefix}_EPREFIX}/sbin" "system admin executabls") + _set_var("${_prefix}" "SYSCONFDIR" "${SYSCONFDIR}" "${${_prefix}_PREFIX}/etc" "read-only single-machine data") + _set_var("${_prefix}" "LOCALSTATEDIR" "${LOCALSTATEDIR}" "${${_prefix}_PREFIX}/var" "modifiable single-machine data") + _set_var("${_prefix}" "BINDIR" "${BINDIR}" "${${_prefix}_EPREFIX}/bin" "user executables") + _set_var("${_prefix}" "LIBDIR" "${LIBDIR}" "${${_prefix}_EPREFIX}/lib" "object code libraries") + _set_var("${_prefix}" "INCLUDEDIR" "${INCLUDEDIR}" "${${_prefix}_PREFIX}/include" "C header files") + _set_var("${_prefix}" "PKGCONFIGDIR" "${PKGCONFIGDIR}" "${${_prefix}_LIBDIR}/pkgconfig" "pkg-config files") + _set_var("${_prefix}" "TYPELIBDIR" "${TYPELIBDIR}" "${${_prefix}_LIBDIR}/girepository-1.0" "GObject run-time introspection data") + _set_var("${_prefix}" "DATAROOTDIR" "${DATAROOTDIR}" "${${_prefix}_PREFIX}/share" "read-only arch.-independent data root") + _set_var("${_prefix}" "DATADIR" "${DATADIR}" "${${_prefix}_DATAROOTDIR}" "read-only architecture-independent data") + _set_var("${_prefix}" "INFODIR" "${INFODIR}" "${${_prefix}_DATAROOTDIR}/info" "info documentation") + _set_var("${_prefix}" "MANDIR" "${MANDIR}" "${${_prefix}_DATAROOTDIR}/man" "man documentation") + _set_var("${_prefix}" "LOCALEDIR" "${LOCALEDIR}" "${${_prefix}_DATAROOTDIR}/locale" "locale-dependent data") + _set_var("${_prefix}" "GIRDIR" "${GIRDIR}" "${${_prefix}_DATAROOTDIR}/gir-1.0" "GObject introspection data") +endfunction() + +# vim: tw=0: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 198c2e6..35609c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -98,7 +98,6 @@ endif() #{{{ Plugin targets get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) -set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}/ufo") set(shared_objects "") set(documented_types "") set(all_targets) @@ -142,18 +141,18 @@ foreach(_src ${ufofilter_SRCS}) list(APPEND all_targets ${target}) install(TARGETS ${target} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR}) + ARCHIVE DESTINATION ${UFO_FILTERS_PLUGINDIR} + LIBRARY DESTINATION ${UFO_FILTERS_PLUGINDIR}) endif() endforeach() -# copy kernels into $LIB_INSTALL_DIR +# copy kernels foreach(_kernel ${ufofilter_KERNELS}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${_kernel} ${CMAKE_CURRENT_BINARY_DIR}/${_kernel}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_kernel} - DESTINATION ${LIB_INSTALL_DIR}) + DESTINATION ${UFO_FILTERS_PLUGINDIR}) endforeach() #}}} #{{{ gtk-doc targets |