summaryrefslogtreecommitdiff
path: root/cmake/options.cmake
diff options
context:
space:
mode:
authorTeus Benschop <teusjannette@gmail.com>2018-10-17 14:17:24 +0200
committerTeus Benschop <teusjannette@gmail.com>2018-10-17 14:17:24 +0200
commit20263805178077fde0038a47e6b4310d7fe62142 (patch)
tree3914b865747903d60fe139d6c70895eaf1a7ed50 /cmake/options.cmake
parent8076ab1d72fefcee310be0419f8a214c57075b97 (diff)
New upstream version 1.7.4
Diffstat (limited to 'cmake/options.cmake')
-rw-r--r--cmake/options.cmake40
1 files changed, 32 insertions, 8 deletions
diff --git a/cmake/options.cmake b/cmake/options.cmake
index 3e07128..4ca7b19 100644
--- a/cmake/options.cmake
+++ b/cmake/options.cmake
@@ -1,3 +1,27 @@
+# Borrowed
+#
+# This macro implements some very special logic how to deal with the cache.
+# By default the various install locations inherit their value from their "parent" variable
+# so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will
+# calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX .
+# This would work completely without using the cache.
+# But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into
+# the cache, otherwise it will be forgotten on the next cmake run.
+# Once a variable is in the cache, it doesn't depend on its "parent" variables
+# anymore and you can only change it by editing it directly.
+# this macro helps in this regard, because as long as you don't set one of the
+# variables explicitely to some location, it will always calculate its value from its
+# parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect.
+# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location
+# this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX.
+macro(_SET_FANCY _var _value _comment)
+ if (NOT DEFINED ${_var})
+ set(${_var} ${_value})
+ else()
+ set(${_var} "${${_var}}" CACHE STRING "${_comment}")
+ endif()
+endmacro(_SET_FANCY)
+
# A list of the options that the library supports
SET(SWORD_PYTHON_INSTALL_DIR "" CACHE STRING "Directory where the Python bindings will be installed. Defaults to default Python path.")
@@ -10,17 +34,17 @@ ELSE(APPLE)
SET(SWORD_INSTALL_DIR "/usr/local")
ENDIF(APPLE)
-IF(CMAKE_INSTALL_PREFIX)
- SET(PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}.")
-ELSE(CMAKE_INSTALL_PREFIX)
- SET(PREFIX "${SWORD_INSTALL_DIR}" CACHE STRING "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}")
-ENDIF(CMAKE_INSTALL_PREFIX)
+_SET_FANCY(CMAKE_INSTALL_PREFIX "${SWORD_INSTALL_DIR}" "Directory into which to install architecture-dependent files. Defaults to ${SWORD_INSTALL_DIR}.")
+
+_SET_FANCY(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" "Object code library install directory. Defaults to ${SWORD_INSTALL_DIR}/lib")
+
+_SET_FANCY(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "C Header files install directory. Defaults to ${SWORD_INSTALL_DIR}/include.")
-SET(LIBDIR "${PREFIX}/lib" CACHE STRING "Object code library install directory. Defaults to ${SWORD_INSTALL_DIR}/lib")
+SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Directory to install binary executable files. Defaults to ${SWORD_INSTALL_DIR}/bin.")
-SET(INCLUDEDIR "${PREFIX}/include" CACHE STRING "C Header files install directory. Defaults to ${SWORD_INSTALL_DIR}/include.")
+_SET_FANCY(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "Directory to install global config files. Defaults to ${SWORD_INSTALL_DIR}/etc.")
-SET(BINDIR "${PREFIX}/bin" CACHE STRING "Directory to install binary executable files. Defaults to ${SWORD_INSTALL_DIR}/bin.")
+_SET_FANCY(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Directory to install global data files. Defaults to ${SWORD_INSTALL_DIR}/share.")
# Post-processing of variables
MACRO(PROCESS_VERSION LEVEL VALUE)