diff options
author | Roger Leigh <rleigh@codelibre.net> | 2016-12-09 21:36:55 (GMT) |
---|---|---|
committer | Roger Leigh <rleigh@dundee.ac.uk> | 2016-12-12 22:23:26 (GMT) |
commit | 53b5d6345dd9216e5110a9645a0aa194926d5688 (patch) | |
tree | 3bb2d720e2805f597cb15c21edcac43aab955289 /Modules/GNUInstallDirs.cmake | |
parent | c968213d2e43945e69ebe4ad12ca933b8f4c4e6f (diff) | |
download | CMake-53b5d6345dd9216e5110a9645a0aa194926d5688.zip CMake-53b5d6345dd9216e5110a9645a0aa194926d5688.tar.gz CMake-53b5d6345dd9216e5110a9645a0aa194926d5688.tar.bz2 |
GNUInstallDirs: Set UNINITALIZED cache properties to type PATH
Also convert the path to a cmake path
Diffstat (limited to 'Modules/GNUInstallDirs.cmake')
-rw-r--r-- | Modules/GNUInstallDirs.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index b8b95bc..9599f27 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -120,11 +120,26 @@ # allow users who create additional path variables to also compute # absolute paths where necessary, using the same logic. +# Convert a cache variable to PATH type + +macro(_GNUInstallDirs_cache_convert_to_path var description) + get_property(_GNUInstallDirs_cache_type CACHE ${var} PROPERTY TYPE) + if(_GNUInstallDirs_cache_type STREQUAL "UNINITIALIZED") + file(TO_CMAKE_PATH "${${var}}" _GNUInstallDirs_cmakepath) + set_property(CACHE ${var} PROPERTY TYPE PATH) + set_property(CACHE ${var} PROPERTY VALUE "${_GNUInstallDirs_cmakepath}") + set_property(CACHE ${var} PROPERTY HELPSTRING "${description}") + unset(_GNUInstallDirs_cmakepath) + endif() + unset(_GNUInstallDirs_cache_type) +endmacro() + # Create a cache variable with default for a path. macro(_GNUInstallDirs_cache_path var default description) if(NOT DEFINED ${var}) set(${var} "${default}" CACHE PATH "${description}") endif() + _GNUInstallDirs_cache_convert_to_path("${var}" "${description}") endmacro() # Create a cache variable with not default for a path, with a fallback @@ -135,6 +150,7 @@ macro(_GNUInstallDirs_cache_path_fallback var default description) set(${var} "" CACHE PATH "${description}") set(${var} "${default}") endif() + _GNUInstallDirs_cache_convert_to_path("${var}" "${description}") endmacro() # Installation directories @@ -232,6 +248,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}") endif() endif() +_GNUInstallDirs_cache_convert_to_path(CMAKE_INSTALL_LIBDIR "Object code libraries (lib)") # Save for next run set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run") |