aboutsummaryrefslogtreecommitdiff
path: root/kde-modules
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@kde.org>2015-01-11 10:57:17 +0000
committerAlex Merry <alex.merry@kde.org>2015-01-11 16:18:38 +0000
commit4462e9ddedb78c31a6f1089d073b1bfde6ce60ce (patch)
tree760bd6cd483ad22aa9b5e59c70818631c34a48d4 /kde-modules
parentca6d601ac04f8ef5813f6b02015a37622d68ef6c (diff)
downloadextra-cmake-modules-4462e9ddedb78c31a6f1089d073b1bfde6ce60ce.tar.gz
extra-cmake-modules-4462e9ddedb78c31a6f1089d073b1bfde6ce60ce.tar.bz2
Do not unset cache variables in KDEInstallDirs.
Cache variables such as CMAKE_INSTALL_BINDIR may be used by other modules included from parallel parts of the tree, so we should not touch them. We still override them in the runtime environment, but this will not interfere with parallel subtrees of the project. As part of this, the order of precedence of variables specified on the command line is changed, so that KDE_INSTALL_* is considered first (although it is still considered "undefined" in the documentation). This means that if you only specify CMAKE_INSTALL_BINDIR, that will be used by both KDEInstallDirs and GNUInstallDirs, but if you specify both that and KDE_INSTALL_BINDIR, KDEInstallDirs will use KDE_INSTALL_BINDIR instead. This is probably not too useful, but seems more useful than any other arrangement. BUG: 342717 REVIEW: 121982
Diffstat (limited to 'kde-modules')
-rw-r--r--kde-modules/KDEInstallDirs.cmake38
1 files changed, 20 insertions, 18 deletions
diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake
index 7d592afc..72a67641 100644
--- a/kde-modules/KDEInstallDirs.cmake
+++ b/kde-modules/KDEInstallDirs.cmake
@@ -163,7 +163,7 @@
# ``${PROJECT_NAME}`` to provide a sensible default for this CMake option.
#=============================================================================
-# Copyright 2014 Alex Merry <alex.merry@kde.org>
+# Copyright 2014-2015 Alex Merry <alex.merry@kde.org>
# Copyright 2013 Stephen Kelly <steveire@gmail.com>
# Copyright 2012 David Faure <faure@kde.org>
# Copyright 2007 Matthias Kretz <kretz@kde.org>
@@ -280,7 +280,18 @@ macro(_define_relative varname parent subdir docstring)
set(_realpath "${_subdir}")
endif()
- if(${_oldstylename})
+ if(KDE_INSTALL_${varname})
+ # make sure the cache documentation is set correctly
+ get_property(_iscached CACHE KDE_INSTALL_${varname} PROPERTY VALUE SET)
+ if (_iscached)
+ # make sure the docs are still set if it was passed on the command line
+ set_property(CACHE KDE_INSTALL_${varname}
+ PROPERTY HELPSTRING "${docstring} (${_docpath})")
+ # make sure the type is correct if it was passed on the command line
+ set_property(CACHE KDE_INSTALL_${varname}
+ PROPERTY TYPE PATH)
+ endif()
+ elseif(${_oldstylename})
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
message(DEPRECATION "${_oldstylename} is deprecated, use KDE_INSTALL_${varname} instead.")
endif()
@@ -290,10 +301,6 @@ macro(_define_relative varname parent subdir docstring)
CACHE PATH
"${docstring} (${_docpath})"
FORCE)
- unset(${_oldstylename} CACHE)
- if(_cmakename AND ${_cmakename})
- unset(${_cmakename} CACHE)
- endif()
elseif(${_cmakename})
if(_cmakename_is_deprecated AND NOT CMAKE_VERSION VERSION_LESS 3.0.0)
message(DEPRECATION "${_cmakename} is deprecated, use KDE_INSTALL_${varname} instead.")
@@ -304,21 +311,12 @@ macro(_define_relative varname parent subdir docstring)
CACHE PATH
"${docstring} (${_docpath})"
FORCE)
- unset(${_cmakename} CACHE)
- elseif(NOT KDE_INSTALL_${varname})
+ else()
+ # insert an empty value into the cache, indicating the default
+ # should be used (including compatibility vars above)
set(KDE_INSTALL_${varname} ""
CACHE PATH "${docstring} (${_docpath})")
set(KDE_INSTALL_${varname} "${_realpath}")
- else()
- get_property(_iscached CACHE KDE_INSTALL_${varname} PROPERTY VALUE SET)
- if (_iscached)
- # make sure the docs are still set if it was passed on the command line
- set_property(CACHE KDE_INSTALL_${varname}
- PROPERTY HELPSTRING "${docstring} (${_docpath})")
- # make sure the type is correct if it was passed on the command line
- set_property(CACHE KDE_INSTALL_${varname}
- PROPERTY TYPE PATH)
- endif()
endif()
mark_as_advanced(KDE_INSTALL_${varname})
@@ -330,6 +328,10 @@ macro(_define_relative varname parent subdir docstring)
set(KDE_INSTALL_FULL_${varname} "${KDE_INSTALL_${varname}}")
endif()
+ # Override compatibility vars at runtime, even though we don't touch
+ # them in the cache; this way, we keep the variables in sync where
+ # KDEInstallDirs is included, but don't interfere with, say,
+ # GNUInstallDirs in a parallel part of the CMake tree.
if(_cmakename)
set(${_cmakename} "${KDE_INSTALL_${varname}}")
set(CMAKE_INSTALL_FULL_${varname} "${KDE_INSTALL_FULL_${varname}}")