GNUInstallDirs.cmake: Various improvements

- Integrate
  c07bba2730 (diff-1e2deb5301e9481203102fcddd1b2d0d2bf0ddc1cbb445c7f4b6414a3b869ce8)
  so that the default man directory is <CMAKE_INSTALL_PREFIX>/share/man
  on FreeBSD systems.

- For good measure, integrate
  f835f189ae
  so that the default info directory is
  <CMAKE_INSTALL_PREFIX>/share/info on FreeBSD systems, even though we
  don't use that directory.

- Automatically set the CMake variable type to PATH for any
  user-specified CMAKE_INSTALL_*DIR variables.

Addresses concerns raised in #326, #346, #648

Closes #648
This commit is contained in:
DRC
2024-01-22 14:07:55 -05:00
parent 335ed793f9
commit 5a2353c2da
2 changed files with 9 additions and 13 deletions

View File

@@ -605,15 +605,6 @@ brackets, then its final value will depend on the final value of that other
variable. For instance, the default value of `CMAKE_INSTALL_MANDIR` is variable. For instance, the default value of `CMAKE_INSTALL_MANDIR` is
**\<CMAKE\_INSTALL\_DATAROOTDIR\>/man**. **\<CMAKE\_INSTALL\_DATAROOTDIR\>/man**.
NOTE: If setting one of these directory variables to a relative path using the
CMake command line, you must specify that the variable is of type `PATH`.
For example:
cmake -G"{generator type}" -DCMAKE_INSTALL_LIBDIR:PATH=lib {source_directory}
Otherwise, CMake will assume that the path is relative to the build directory
rather than the install directory.
Creating Distribution Packages Creating Distribution Packages
============================== ==============================

View File

@@ -118,9 +118,10 @@
# absolute paths where necessary, using the same logic. # absolute paths where necessary, using the same logic.
#============================================================================= #=============================================================================
# Copyright 2018 Tobias C. Berner
# Copyright 2018 Matthias Räncker # Copyright 2018 Matthias Räncker
# Copyright 2016, 2019 D. R. Commander # Copyright 2016, 2019, 2024 D. R. Commander
# Copyright 2016 Dmitry Marakasov # Copyright 2016, 2021 Dmitry Marakasov
# Copyright 2016 Roger Leigh # Copyright 2016 Roger Leigh
# Copyright 2015 Alex Turbov # Copyright 2015 Alex Turbov
# Copyright 2014 Rolf Eike Beer # Copyright 2014 Rolf Eike Beer
@@ -181,6 +182,10 @@ macro(GNUInstallDirs_set_install_dir var docstring)
set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "FORCE") set(_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var} "FORCE")
endif() endif()
if(DEFINED CMAKE_INSTALL_${var} AND NOT CMAKE_INSTALL_${var} MATCHES "^/")
set_property(CACHE CMAKE_INSTALL_${var} PROPERTY TYPE PATH)
endif()
set(CMAKE_INSTALL_${var} "${CMAKE_INSTALL_DEFAULT_${var}}" CACHE PATH set(CMAKE_INSTALL_${var} "${CMAKE_INSTALL_DEFAULT_${var}}" CACHE PATH
"${docstring} (Default: ${CMAKE_INSTALL_DEFAULT_${var}})" "${docstring} (Default: ${CMAKE_INSTALL_DEFAULT_${var}})"
${_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var}}) ${_GNUInstallDirs_CMAKE_INSTALL_FORCE_${var}})
@@ -300,7 +305,7 @@ GNUInstallDirs_set_install_dir(DATADIR
"The directory under which read-only architecture-independent data files should be installed") "The directory under which read-only architecture-independent data files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INFODIR) if(NOT DEFINED CMAKE_INSTALL_DEFAULT_INFODIR)
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$") if(CMAKE_SYSTEM_NAME MATCHES "^(([^kF].*)?BSD|DragonFly)$")
set(CMAKE_INSTALL_DEFAULT_INFODIR "info") set(CMAKE_INSTALL_DEFAULT_INFODIR "info")
else() else()
set(CMAKE_INSTALL_DEFAULT_INFODIR "<CMAKE_INSTALL_DATAROOTDIR>/info") set(CMAKE_INSTALL_DEFAULT_INFODIR "<CMAKE_INSTALL_DATAROOTDIR>/info")
@@ -310,7 +315,7 @@ GNUInstallDirs_set_install_dir(INFODIR
"The directory into which info documentation files should be installed") "The directory into which info documentation files should be installed")
if(NOT DEFINED CMAKE_INSTALL_DEFAULT_MANDIR) if(NOT DEFINED CMAKE_INSTALL_DEFAULT_MANDIR)
if(CMAKE_SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$") if(CMAKE_SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(FreeBSD)$")
set(CMAKE_INSTALL_DEFAULT_MANDIR "man") set(CMAKE_INSTALL_DEFAULT_MANDIR "man")
else() else()
set(CMAKE_INSTALL_DEFAULT_MANDIR "<CMAKE_INSTALL_DATAROOTDIR>/man") set(CMAKE_INSTALL_DEFAULT_MANDIR "<CMAKE_INSTALL_DATAROOTDIR>/man")