diff --git a/Help/release/dev/find-modules.rst b/Help/release/dev/find-modules.rst index f0022d5d59..3d9bb1abd6 100644 --- a/Help/release/dev/find-modules.rst +++ b/Help/release/dev/find-modules.rst @@ -10,6 +10,9 @@ Find Modules * The :module:`FindEXPAT` module now provides a ``EXPAT_VERSION`` result variable. The ``EXPAT_VERSION_STRING`` result variable is deprecated. +* The :module:`FindFreetype` module now provides a ``Freetype_VERSION`` result + variable. The ``FREETYPE_VERSION_STRING`` result variable is deprecated. + * The :module:`FindPostgreSQL` module now provides a ``PostgreSQL_VERSION`` result variable. The ``PostgreSQL_VERSION_STRING`` result variable is deprecated. diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 0a4d9a36c2..a120fec506 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -5,7 +5,11 @@ FindFreetype ------------ -Finds the FreeType font renderer library. +Finds the FreeType font renderer library: + +.. code-block:: cmake + + find_package(Freetype [] [...]) Imported Targets ^^^^^^^^^^^^^^^^ @@ -24,9 +28,14 @@ Result Variables This module defines the following variables: ``Freetype_FOUND`` - Boolean indicating whether the (requested version of) Freetype is found. For - backward compatibility, the ``FREETYPE_FOUND`` variable is also set to the - same value. + Boolean indicating whether (the requested version of) Freetype is found. + For backward compatibility, the ``FREETYPE_FOUND`` variable is also set + to the same value. + +``Freetype_VERSION`` + .. versionadded:: 4.2 + + The version of Freetype found. ``FREETYPE_INCLUDE_DIRS`` Include directories containing headers needed to use Freetype. This is the @@ -36,9 +45,6 @@ This module defines the following variables: ``FREETYPE_LIBRARIES`` Libraries needed to link against for using Freetype. -``FREETYPE_VERSION_STRING`` - The version of Freetype found. - .. versionadded:: 3.7 Debug and Release library variants are found separately. @@ -62,6 +68,17 @@ This module accepts the following variables: The user may set this environment variable to the root directory of a Freetype installation to find Freetype in non-standard locations. +Deprecated Variables +^^^^^^^^^^^^^^^^^^^^ + +The following variables are provided for backward compatibility: + +``FREETYPE_VERSION_STRING`` + .. deprecated:: 4.2 + Superseded by the ``Freetype_VERSION``. + + The version of Freetype found. + Examples ^^^^^^^^ @@ -170,20 +187,21 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) file(STRINGS "${FREETYPE_H}" freetype_version_str REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") - unset(FREETYPE_VERSION_STRING) + unset(Freetype_VERSION) foreach(VPART MAJOR MINOR PATCH) foreach(VLINE ${freetype_version_str}) if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$") set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}") - if(FREETYPE_VERSION_STRING) - string(APPEND FREETYPE_VERSION_STRING ".${FREETYPE_VERSION_PART}") + if(Freetype_VERSION) + string(APPEND Freetype_VERSION ".${FREETYPE_VERSION_PART}") else() - set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") + set(Freetype_VERSION "${FREETYPE_VERSION_PART}") endif() unset(FREETYPE_VERSION_PART) endif() endforeach() endforeach() + set(FREETYPE_VERSION_STRING ${Freetype_VERSION}) endif() include(FindPackageHandleStandardArgs) @@ -194,7 +212,7 @@ find_package_handle_standard_args( FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS VERSION_VAR - FREETYPE_VERSION_STRING + Freetype_VERSION ) mark_as_advanced( diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 28c66b3119..6b2020f43f 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -116,7 +116,7 @@ foreach( CUDA DOXYGEN EXPAT - FLEX + FLEX Freetype GIF GTK2 HDF5 JPEG diff --git a/Tests/FindFreetype/Test/CMakeLists.txt b/Tests/FindFreetype/Test/CMakeLists.txt index 857777e75c..fe2b7545ea 100644 --- a/Tests/FindFreetype/Test/CMakeLists.txt +++ b/Tests/FindFreetype/Test/CMakeLists.txt @@ -4,7 +4,7 @@ include(CTest) find_package(Freetype REQUIRED) -add_definitions(-DCMAKE_EXPECTED_FREETYPE_VERSION="${FREETYPE_VERSION_STRING}") +add_definitions(-DCMAKE_EXPECTED_FREETYPE_VERSION="${Freetype_VERSION}") add_executable(testfreetype_tgt main.c) target_link_libraries(testfreetype_tgt Freetype::Freetype)