From f9cff5e52f567ec8dbecd3b0261495ba401ebd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 15 Nov 2014 15:41:00 +0100 Subject: [PATCH] modules: get rid of WITH_FIND_MODULE. CMake find modules are now *always* installed into /share/cmake/Magnum, without requirement for root privileges. --- CMakeLists.txt | 4 +--- doc/building.dox | 4 ---- modules/CMakeLists.txt | 8 +++++--- modules/FindMagnum.cmake | 3 --- modules/MagnumConfig.cmake | 26 ++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 modules/MagnumConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ba4cd811f..a9c671613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,6 @@ option(TARGET_GLES "Build for OpenGL ES instead of desktop OpenGL" OFF) cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2" ON "TARGET_GLES" OFF) cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF) -option(WITH_FIND_MODULE "Install FindMagnum.cmake module into CMake's module dir (might require admin privileges)" OFF) - # Parts of the library option(WITH_AUDIO "Build Audio library" OFF) option(WITH_DEBUGTOOLS "Build DebugTools library" ON) @@ -195,7 +193,7 @@ include(${CORRADE_LIB_SUFFIX_MODULE}) set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum) -set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules) +set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/cmake/Magnum) set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumExternal) set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) diff --git a/doc/building.dox b/doc/building.dox index 5d584491b..49147194e 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -152,10 +152,6 @@ instead of `magnum`. Headers and other files are the same for both. The library and plugin distinction is handled semi-automatically when using Magnum in depending projects, see @ref cmake for more information. -Magnum by default does not install `FindMagnum.cmake`, as you should bundle -the module with your code instead of depending on it being in system location. -You can install it by enabling `WITH_FIND_MODULE`. - The library is constantly evolving and thus some APIs are deprecated and then later removed in favor of better ones. To preserve backwards compatibility, Magnum is by default built with all deprecated APIs. However, to make your diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 06b78919d..f9921eea1 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -23,6 +23,8 @@ # DEALINGS IN THE SOFTWARE. # -if(WITH_FIND_MODULE) - install(FILES FindMagnum.cmake DESTINATION ${MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR}) -endif() +set(Magnum_MODULES + FindMagnum.cmake + MagnumConfig.cmake) + +install(FILES ${Magnum_MODULES} DESTINATION ${MAGNUM_CMAKE_MODULE_INSTALL_DIR}) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index b88ae57e0..00580cd1d 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -127,8 +127,6 @@ # installation directory # MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_INSTALL_DIR - Audio importer # plugin installation directory -# MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR - Installation dir for CMake Find* -# modules # MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory # MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory # @@ -548,7 +546,6 @@ set(MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR set(MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/importers) set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/audioimporters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters) -set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules) set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum) set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins) mark_as_advanced(FORCE diff --git a/modules/MagnumConfig.cmake b/modules/MagnumConfig.cmake new file mode 100644 index 000000000..280bc0818 --- /dev/null +++ b/modules/MagnumConfig.cmake @@ -0,0 +1,26 @@ +# +# This file is part of Magnum. +# +# Copyright © 2010, 2011, 2012, 2013, 2014 +# Vladimír Vondruš +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +include(${CMAKE_CURRENT_LIST_DIR}/FindMagnum.cmake)