diff options
author | Pierluigi Taddei <pierluigi.taddei@gmail.com> | 2016-09-08 18:26:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-15 17:35:25 (GMT) |
commit | 31be918b0b2dd445bdf85d72a8eaa29841137bc8 (patch) | |
tree | 35af3199ab0fb54a1722d67ecf2a573e3efc153d /Help/command | |
parent | 010140311a0aa9336b7e2a2d22c177d445ee1c32 (diff) | |
download | CMake-31be918b0b2dd445bdf85d72a8eaa29841137bc8.zip CMake-31be918b0b2dd445bdf85d72a8eaa29841137bc8.tar.gz CMake-31be918b0b2dd445bdf85d72a8eaa29841137bc8.tar.bz2 |
find_package: Optionally sort globbed directories in a meaningful order
Add `CMAKE_FIND_PACKAGE_SORT_{ORDER,DIRECTION}` variables to specify
sort order and direction.
When multiple package with the same name have been found in the same
location sorting option can be used to force a specific version to be
loaded (e.g. libA_1.12.0 instead of libA_1.1.0). Currently sorting by
NAME and by NATURAL order have been implemented.
Natural ordering makes use of the `strverscmp(3)` ordering.
Diffstat (limited to 'Help/command')
-rw-r--r-- | Help/command/find_package.rst | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index c44fe86..2cb1e5f 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -170,11 +170,21 @@ is acceptable the following variables are set: ``<package>_VERSION_COUNT`` number of version components, 0 to 4 -and the corresponding package configuration file is loaded. When -multiple package configuration files are available whose version files +and the corresponding package configuration file is loaded. +When multiple package configuration files are available whose version files claim compatibility with the version requested it is unspecified which -one is chosen. No attempt is made to choose a highest or closest -version number. +one is chosen: unless the variable :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` +is set no attempt is made to choose a highest or closest version number. + +To control the order in which ``find_package`` checks for compatibiliy use +the two variables :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` and +:variable:`CMAKE_FIND_PACKAGE_SORT_DIRECTION`. +For instance in order to select the highest version one can set:: + + SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL) + SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC) + +before calling ``find_package``. Config mode provides an elaborate interface and search procedure. Much of the interface is provided for completeness and for use |