1 # Mimick `GNUInstallDirs` for one more install directory, the one where
2 # project's installed cmake subdirs go.
4 # These functions are internal functions vendored in from GNUInstallDirs (with
5 # new names), so we don't depend on unstable implementation details. They are
6 # also simplified to only handle the cases we need.
8 # The purpose would appear to be making `CACHE PATH` vars in a way that
9 # bypasses the legacy oddity that `-D<PATH>` gets canonicalized, despite
10 # non-canonical `CACHE PATH`s being perfectly valid.
12 macro(_GNUInstallPackageDir_cache_convert_to_path var description)
13 get_property(_GNUInstallPackageDir_cache_type CACHE ${var} PROPERTY TYPE)
14 if(_GNUInstallPackageDir_cache_type STREQUAL "UNINITIALIZED")
15 file(TO_CMAKE_PATH "${${var}}" _GNUInstallPackageDir_cmakepath)
16 set_property(CACHE ${var} PROPERTY TYPE PATH)
17 set_property(CACHE ${var} PROPERTY VALUE "${_GNUInstallPackageDir_cmakepath}")
18 set_property(CACHE ${var} PROPERTY HELPSTRING "${description}")
19 unset(_GNUInstallPackageDir_cmakepath)
21 unset(_GNUInstallPackageDir_cache_type)
24 # Create a cache variable with default for a path.
25 macro(_GNUInstallPackageDir_cache_path var default description)
26 if(NOT DEFINED ${var})
27 set(${var} "${default}" CACHE PATH "${description}")
29 _GNUInstallPackageDir_cache_convert_to_path("${var}" "${description}")
32 _GNUInstallPackageDir_cache_path(CMAKE_INSTALL_PACKAGEDIR "lib${LLVM_LIBDIR_SUFFIX}/cmake"
33 "Directories containing installed CMake modules (lib/cmake)")