From 30aae1bd48e640cd2532ab9ce79b5c66b48d310d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 30 Jan 2014 21:47:06 +0100 Subject: [PATCH] modules: actually detect the MAGNUM_PLUGINS_DIR. It now defaults to magnum/ subdirectory of dir where main Magnum library was found. It was *annoying* to change /usr/local/lib/magnum to /usr/lib/magnum _every time_. --- doc/cmake.dox | 9 +++++---- modules/FindMagnum.cmake | 11 +++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/cmake.dox b/doc/cmake.dox index 07cd6fc26..21e776f4d 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -44,10 +44,11 @@ variables: - `MAGNUM_FOUND` -- Whether the library was found - `MAGNUM_LIBRARIES` -- %Magnum library and dependent libraries - `MAGNUM_INCLUDE_DIRS` -- Root include dir and include dirs of dependencies -- `MAGNUM_PLUGINS_DIR` -- Base directory with plugins. You can modify it - (e.g. set it to `.` when deploying on Windows with plugins stored - relatively to the executable), the following `MAGNUM_PLUGINS_*_DIR` - variables depend on it. +- `MAGNUM_PLUGINS_DIR` -- Base directory with plugins, defaults to `magnum/` + subdirectory of dir where Magnum library was found. You can modify it (e.g. + set it to `.` when deploying on Windows with plugins stored relatively to + the executable), the following `MAGNUM_PLUGINS_*_DIR` variables depend on + it. - `MAGNUM_PLUGINS_FONT_DIR` -- Directory with font plugins - `MAGNUM_PLUGINS_FONTCONVERTER_DIR` -- Directory with font converter plugins - `MAGNUM_PLUGINS_IMAGECONVERTER_DIR` -- Directory with image converter diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 6b8a2f99b..c742edceb 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -7,9 +7,10 @@ # MAGNUM_LIBRARIES - Magnum library and dependent libraries # MAGNUM_INCLUDE_DIRS - Root include dir and include dirs of # dependencies -# MAGNUM_PLUGINS_DIR - Base directory with plugins. You can modify -# it (e.g. set it to `.` when deploying on Windows with plugins stored -# relatively to the executable), the following MAGNUM_PLUGINS_*_DIR +# MAGNUM_PLUGINS_DIR - Base directory with plugins, defaults to +# `magnum/` subdirectory of dir where Magnum library was found. You can +# modify it (e.g. set it to `.` when deploying on Windows with plugins +# stored relatively to the executable), the following MAGNUM_PLUGINS_*_DIR # variables depend on it. # MAGNUM_PLUGINS_FONT_DIR - Directory with font plugins # MAGNUM_PLUGINS_FONTCONVERTER_DIR - Directory with font converter plugins @@ -404,7 +405,9 @@ if(MAGNUM_BUILD_DEPRECATED) set(MAGNUM_PLUGINS_INCLUDE_DIR ${MAGNUM_INCLUDE_DIR}/MagnumPlugins) endif() -set(MAGNUM_PLUGINS_DIR ${MAGNUM_PLUGINS_INSTALL_DIR} +# Get base plugin directory from main library location +get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY} PATH) +set(MAGNUM_PLUGINS_DIR ${_MAGNUM_LIBRARY_PATH}/magnum CACHE PATH "Base directory where to look for Magnum plugins") # Plugin directories