diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 52d137ff28..64b35b5de0 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -5,47 +5,62 @@ FindPNG ------- -Find libpng, the official reference library for the PNG image format. +Finds libpng, the official reference library for the PNG image format. + +.. note:: + + The PNG library depends on the ZLib compression library, which must be found + for this module to succeed. Imported Targets ^^^^^^^^^^^^^^^^ .. versionadded:: 3.5 -This module defines the following :prop_tgt:`IMPORTED` target: +This module defines the following :ref:`Imported Targets`: ``PNG::PNG`` The libpng library, if found. -Result variables +Result Variables ^^^^^^^^^^^^^^^^ -This module will set the following variables in your project: +This module sets the following variables: ``PNG_INCLUDE_DIRS`` - where to find png.h, etc. + Directory containing the PNG headers (e.g., ``png.h``). ``PNG_LIBRARIES`` - the libraries to link against to use PNG. + PNG libraries required for linking. ``PNG_DEFINITIONS`` - You should add_definitions(${PNG_DEFINITIONS}) before compiling code - that includes png library files. + Compile definitions for using PNG, if any. They can be added with + :command:`target_compile_definitions` command when not using the ``PNG::PNG`` + imported target. ``PNG_FOUND`` - If false, do not try to use PNG. + True if PNG library is found. ``PNG_VERSION_STRING`` - the version of the PNG library found (since CMake 2.8.8) + .. versionadded:: 2.8.8 -Obsolete variables + The version of the PNG library found. + +Obsolete Variables ^^^^^^^^^^^^^^^^^^ -The following variables may also be set, for backwards compatibility: +The following variables may also be set for backward compatibility: ``PNG_LIBRARY`` - where to find the PNG library. + Path to the PNG library. ``PNG_INCLUDE_DIR`` - where to find the PNG headers (same as PNG_INCLUDE_DIRS) + Directory containing the PNG headers (same as ``PNG_INCLUDE_DIRS``). -Since PNG depends on the ZLib compression library, none of the above -will be defined unless ZLib can be found. +Examples +^^^^^^^^ + +Finding PNG library and using it in a project: + +.. code-block:: cmake + + find_package(PNG) + target_link_libraries(project_target PRIVATE PNG::PNG) #]=======================================================================] cmake_policy(PUSH)