diff options
author | Brad King <brad.king@kitware.com> | 2018-11-21 12:41:21 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-11-21 12:41:27 (GMT) |
commit | 2b427c2fadc917ebcaf2f246d53504ce5b6ad754 (patch) | |
tree | aa6bc418e2f3861e25d9af347f8df74d7993c636 /Modules | |
parent | 8b83d1fdffeab9d24946552a9b8252c2e0dc4570 (diff) | |
parent | 74cc42e937e3117e9514f0c1561f212a8867bc92 (diff) | |
download | CMake-2b427c2fadc917ebcaf2f246d53504ce5b6ad754.zip CMake-2b427c2fadc917ebcaf2f246d53504ce5b6ad754.tar.gz CMake-2b427c2fadc917ebcaf2f246d53504ce5b6ad754.tar.bz2 |
Merge topic 'FindGIF-modernize'
74cc42e937 Help: Add notes for topic 'FindGIF-modernize'
6962a41e6b FindGIF: Add test
5bc64fe6c2 FindGIF: Modernize
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2632
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindGIF.cmake | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 9a995af..9687b57 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -7,22 +7,43 @@ FindGIF This finds the GIF library (giflib) -The module defines the following variables: +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` target: + +``GIF::GIF`` + The giflib library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: ``GIF_FOUND`` - True if giflib was found + If false, do not try to use GIF. +``GIF_INCLUDE_DIRS`` + where to find gif_lib.h, etc. ``GIF_LIBRARIES`` - Libraries to link to in order to use giflib -``GIF_INCLUDE_DIR`` - where to find the headers + the libraries needed to use GIF. ``GIF_VERSION`` - 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6 + 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6. + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: -The minimum required version of giflib can be specified using the -standard syntax, e.g. find_package(GIF 4) +``GIF_INCLUDE_DIR`` + where to find the GIF headers. +``GIF_LIBRARY`` + where to find the GIF library. + +Hints +^^^^^ -$GIF_DIR is an environment variable that would correspond to the -./configure --prefix=$GIF_DIR +``GIF_DIR`` is an environment variable that would correspond to the +``./configure --prefix=$GIF_DIR``. #]=======================================================================] # Created by Eric Wing. @@ -44,9 +65,6 @@ find_library(GIF_LIBRARY PATH_SUFFIXES lib ) -# see readme.txt -set(GIF_LIBRARIES ${GIF_LIBRARY}) - # Very basic version detection. # The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems # to be always " Version 2.0, " in versions 3.x of giflib. @@ -90,4 +108,20 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR VERSION_VAR GIF_VERSION ) +if(GIF_FOUND) + set(GIF_INCLUDE_DIRS "${GIF_INCLUDE_DIR}") + set(GIF_LIBRARIES ${GIF_LIBRARY}) + + if(NOT TARGET GIF::GIF) + add_library(GIF::GIF UNKNOWN IMPORTED) + set_target_properties(GIF::GIF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIRS}") + if(EXISTS "${GIF_LIBRARY}") + set_target_properties(GIF::GIF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${GIF_LIBRARY}") + endif() + endif() +endif() + mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY) |