diff options
author | Brad King <brad.king@kitware.com> | 2022-11-08 14:04:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-11-08 14:04:43 (GMT) |
commit | a0ad3209b5df98d8e4de7c945ffa083b95bbbe52 (patch) | |
tree | c0a33655a8a1ca10fc9b54d36da1ee7b7fa1a17f /Modules | |
parent | 01fe92f35fcbbedb939d861bbbe1e2ab36af77ca (diff) | |
parent | 9e3f1723ff931c07ca18e1d3256ba2063e7b4b86 (diff) | |
download | CMake-a0ad3209b5df98d8e4de7c945ffa083b95bbbe52.zip CMake-a0ad3209b5df98d8e4de7c945ffa083b95bbbe52.tar.gz CMake-a0ad3209b5df98d8e4de7c945ffa083b95bbbe52.tar.bz2 |
Merge topic 'find-version-vars'
9e3f1723ff Find{BZip2,LibLZMA,ZLIB}: use *_VERSION as modern CMake
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !7877
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindBZip2.cmake | 21 | ||||
-rw-r--r-- | Modules/FindLibLZMA.cmake | 18 | ||||
-rw-r--r-- | Modules/FindZLIB.cmake | 66 |
3 files changed, 81 insertions, 24 deletions
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 355c4bb..326e700 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -29,8 +29,11 @@ This module defines the following variables: Link these to use BZip2 ``BZIP2_NEED_PREFIX`` this is set if the functions are prefixed with ``BZ2_`` -``BZIP2_VERSION_STRING`` - the version of BZip2 found +``BZIP2_VERSION`` + .. versionadded:: 3.26 + the version of BZip2 found. + + See also legacy variable ``BZIP2_VERSION_STRING``. Cache variables ^^^^^^^^^^^^^^^ @@ -39,6 +42,17 @@ The following cache variables may also be set: ``BZIP2_INCLUDE_DIR`` the BZip2 include directory + +Legacy Variables +^^^^^^^^^^^^^^^^ + +The following variables are provided for backward compatibility: + +``BZIP2_VERSION_STRING`` + the version of BZip2 found. + + .. versionchanged:: 3.26 + Superseded by ``BZIP2_VERSION``. #]=======================================================================] set(_BZIP2_PATHS PATHS @@ -60,12 +74,13 @@ endif () if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h") file(STRINGS "${BZIP2_INCLUDE_DIR}/bzlib.h" BZLIB_H REGEX "bzip2/libbzip2 version [0-9]+\\.[^ ]+ of [0-9]+ ") string(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}") + set(BZIP2_VERSION ${BZIP2_VERSION_STRING}) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR - VERSION_VAR BZIP2_VERSION_STRING) + VERSION_VAR BZIP2_VERSION) if (BZIP2_FOUND) set(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR}) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index 9ec8f07..c298bab 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -33,6 +33,17 @@ This module will set the following variables in your project: True if lzma_easy_encoder() is found (required). ``LIBLZMA_HAS_LZMA_PRESET`` True if lzma_lzma_preset() is found (required). +``LIBLZMA_VERSION`` + .. versionadded:: 3.26 + the version of LZMA found. + + See also legacy variable ``LIBLZMA_VERSION_STRING``. + +Legacy Variables +^^^^^^^^^^^^^^^^ + +The following variables are provided for backward compatibility: + ``LIBLZMA_VERSION_MAJOR`` The major version of lzma ``LIBLZMA_VERSION_MINOR`` @@ -41,6 +52,10 @@ This module will set the following variables in your project: The patch version of lzma ``LIBLZMA_VERSION_STRING`` version number as a string (ex: "5.0.3") + + .. versionchanged:: 3.26 + Superseded by ``LIBLZMA_VERSION``. + #]=======================================================================] find_path(LIBLZMA_INCLUDE_DIR lzma.h ) @@ -61,6 +76,7 @@ if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}") set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}") + set(LIBLZMA_VERSION ${LIBLZMA_VERSION_STRING}) unset(LIBLZMA_HEADER_CONTENTS) endif() @@ -91,7 +107,7 @@ find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET - VERSION_VAR LIBLZMA_VERSION_STRING + VERSION_VAR LIBLZMA_VERSION ) mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index cfe6715..d0deb87 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -20,33 +20,57 @@ Result Variables This module defines the following variables: -:: +``ZLIB_INCLUDE_DIRS`` + where to find zlib.h, etc. +``ZLIB_LIBRARIES`` + List of libraries when using zlib. +``ZLIB_FOUND`` + True if zlib found. +``ZLIB_VERSION`` + .. versionadded:: 3.26 + the version of Zlib found. + + See also legacy variable ``ZLIB_VERSION_STRING``. - ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. - ZLIB_LIBRARIES - List of libraries when using zlib. - ZLIB_FOUND - True if zlib found. +.. versionadded:: 3.4 + Debug and Release variants are found separately. -:: +Legacy Variables +^^^^^^^^^^^^^^^^ - ZLIB_VERSION_STRING - The version of zlib found (x.y.z) - ZLIB_VERSION_MAJOR - The major version of zlib - ZLIB_VERSION_MINOR - The minor version of zlib - ZLIB_VERSION_PATCH - The patch version of zlib - ZLIB_VERSION_TWEAK - The tweak version of zlib +The following variables are provided for backward compatibility: -.. versionadded:: 3.4 - Debug and Release variants are found separately. +``ZLIB_VERSION_MAJOR`` + The major version of zlib. + + .. versionchanged:: 3.26 + Superseded by ``ZLIB_VERSION``. +``ZLIB_VERSION_MINOR`` + The minor version of zlib. -Backward Compatibility -^^^^^^^^^^^^^^^^^^^^^^ + .. versionchanged:: 3.26 + Superseded by ``ZLIB_VERSION``. +``ZLIB_VERSION_PATCH`` + The patch version of zlib. -The following variable are provided for backward compatibility + .. versionchanged:: 3.26 + Superseded by ``ZLIB_VERSION``. +``ZLIB_VERSION_TWEAK`` + The tweak version of zlib. -:: + .. versionchanged:: 3.26 + Superseded by ``ZLIB_VERSION``. +``ZLIB_VERSION_STRING`` + The version of zlib found (x.y.z) - ZLIB_MAJOR_VERSION - The major version of zlib - ZLIB_MINOR_VERSION - The minor version of zlib - ZLIB_PATCH_VERSION - The patch version of zlib + .. versionchanged:: 3.26 + Superseded by ``ZLIB_VERSION``. +``ZLIB_MAJOR_VERSION`` + The major version of zlib. Superseded by ``ZLIB_VERSION_MAJOR``. +``ZLIB_MINOR_VERSION`` + The minor version of zlib. Superseded by ``ZLIB_VERSION_MINOR``. +``ZLIB_PATCH_VERSION`` + The patch version of zlib. Superseded by ``ZLIB_VERSION_PATCH``. Hints ^^^^^ @@ -168,11 +192,13 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") + + set(ZLIB_VERSION ${ZLIB_VERSION_STRING}) endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR - VERSION_VAR ZLIB_VERSION_STRING + VERSION_VAR ZLIB_VERSION HANDLE_COMPONENTS) if(ZLIB_FOUND) |