diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index cebe051582055d4abc62adf6760125eac0609ad6..4a62c5b5baa4a089f7f0e4917ba0e32c208a3598 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -143,6 +143,10 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: * |CMAKE_SYSTEM_XXX_PATH| * |CMAKE_SYSTEM_XXX_MAC_PATH| + The platform paths that these variables contain are locations that + typically include installed software. An example being ``/usr/local`` for + UNIX based platforms. + 7. Search the paths specified by the PATHS option or in the short-hand version of the command. These are typically hard-coded guesses. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 67532685081daf48224b07e18798250104dd7fbc..3547adab4744405e9067712a5d73a72d3b2cb10f 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -351,6 +351,10 @@ enabled. CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_APPBUNDLE_PATH + The platform paths that these variables contain are locations that + typically include installed software. An example being ``/usr/local`` for + UNIX based platforms. + 8. Search paths stored in the CMake :ref:`System Package Registry`. This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed or by setting the :variable:`CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY` diff --git a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst index 87a9d06a80e7860b69c2ab753858e1faef86ed88..e0ee97916e59f4e9e64eeb33fd0b7af4409cc419 100644 --- a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst +++ b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst @@ -8,11 +8,40 @@ CMAKE_SYSTEM_PREFIX_PATH subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own documentation. -By default this contains the standard directories for the current system, the +By default this contains the system directories for the current system, the :variable:`CMAKE_INSTALL_PREFIX`, and the :variable:`CMAKE_STAGING_PREFIX`. The installation and staging prefixes may be excluded by setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` variable. +The system directories that are contained in ``CMAKE_SYSTEM_PREFIX_PATH`` are +locations that typically include installed software. An example being +``/usr/local`` for UNIX based platforms. In addition to standard platform +locations, CMake will also add values to ``CMAKE_SYSTEM_PREFIX_PATH`` based on +environment variables. The environment variables and search locations that +CMake uses may evolve over time, as platforms and their conventions also +evolve. The following provides an indicative list of environment variables +and locations that CMake searches, but they are subject to change: + + +CrayLinuxEnvironment: + * ``ENV{SYSROOT_DIR}/`` + * ``ENV{SYSROOT_DIR}/usr`` + * ``ENV{SYSROOT_DIR}/usr/local`` + +Darwin: + * ``ENV{SDKROOT}/usr`` When ``CMAKE_OSX_SYSROOT`` is not explicitly specified. + +OpenBSD: + * ``ENV{LOCALBASE}`` + +Windows: + * ``ENV{ProgramW6432}`` + * ``ENV{ProgramFiles}`` + * ``ENV{ProgramFiles(x86)}`` + * ``ENV{SystemDrive}/Program Files`` + * ``ENV{SystemDrive}/Program Files (x86)`` + + ``CMAKE_SYSTEM_PREFIX_PATH`` is *not* intended to be modified by the project; use :variable:`CMAKE_PREFIX_PATH` for this. diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 98c83aa872ef7261b47da26af7a8b09a55579b41..7fe64cb4de7a062a7efc27ab3647f5d3fe491326 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -21,6 +21,10 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) # List common installation prefixes. These will be used for all # search types. +# +# Reminder when adding new locations computed from environment variables +# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst +# synchronized list(APPEND CMAKE_SYSTEM_PREFIX_PATH # Standard /usr/local /usr / @@ -86,6 +90,9 @@ set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT unset(_cmake_sysroot_compile) +# Reminder when adding new locations computed from environment variables +# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst +# synchronized if(CMAKE_COMPILER_SYSROOT) list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_COMPILER_SYSROOT}") endif() diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 71cc6095a2c0f12bf8702c017484001c6fd20ba1..b9e2f179795fa74f2e0c021b0cdf0f200e227b74 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -24,6 +24,10 @@ set(__WINDOWS_PATHS_INCLUDED 1) # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] # ENV{ProgramFiles} = [C:\Program Files (x86)] # ENV{ProgramW6432} = [C:\Program Files] +# +# Reminder when adding new locations computed from environment variables +# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst +# synchronized set(_programfiles "") foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)") if(DEFINED "ENV{${v}}")