mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-12 03:46:46 +02:00
Merge "Do not find_package image libraries if not needed." into main
This commit is contained in:
commit
e3366659a0
@ -99,6 +99,16 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include dependencies.
|
# Include dependencies.
|
||||||
|
if(WEBP_BUILD_ANIM_UTILS
|
||||||
|
OR WEBP_BUILD_CWEBP
|
||||||
|
OR WEBP_BUILD_DWEBP
|
||||||
|
OR WEBP_BUILD_EXTRAS
|
||||||
|
OR WEBP_BUILD_GIF2WEBP
|
||||||
|
OR WEBP_BUILD_IMG2WEBP)
|
||||||
|
set(WEBP_FIND_IMG_LIBS TRUE)
|
||||||
|
else()
|
||||||
|
set(WEBP_FIND_IMG_LIBS FALSE)
|
||||||
|
endif()
|
||||||
include(cmake/deps.cmake)
|
include(cmake/deps.cmake)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
@ -74,7 +74,8 @@ endif()
|
|||||||
# Find the standard image libraries.
|
# Find the standard image libraries.
|
||||||
set(WEBP_DEP_IMG_LIBRARIES)
|
set(WEBP_DEP_IMG_LIBRARIES)
|
||||||
set(WEBP_DEP_IMG_INCLUDE_DIRS)
|
set(WEBP_DEP_IMG_INCLUDE_DIRS)
|
||||||
foreach(I_LIB PNG JPEG TIFF)
|
if(WEBP_FIND_IMG_LIBS)
|
||||||
|
foreach(I_LIB PNG JPEG TIFF)
|
||||||
# Disable tiff when compiling in static mode as it is failing on Ubuntu.
|
# Disable tiff when compiling in static mode as it is failing on Ubuntu.
|
||||||
if(WEBP_LINK_STATIC AND ${I_LIB} STREQUAL "TIFF")
|
if(WEBP_LINK_STATIC AND ${I_LIB} STREQUAL "TIFF")
|
||||||
message(STATUS "TIFF is disabled when statically linking.")
|
message(STATUS "TIFF is disabled when statically linking.")
|
||||||
@ -87,22 +88,22 @@ foreach(I_LIB PNG JPEG TIFF)
|
|||||||
list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS ${${I_LIB}_INCLUDE_DIR}
|
list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS ${${I_LIB}_INCLUDE_DIR}
|
||||||
${${I_LIB}_INCLUDE_DIRS})
|
${${I_LIB}_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if(WEBP_DEP_IMG_INCLUDE_DIRS)
|
if(WEBP_DEP_IMG_INCLUDE_DIRS)
|
||||||
list(REMOVE_DUPLICATES WEBP_DEP_IMG_INCLUDE_DIRS)
|
list(REMOVE_DUPLICATES WEBP_DEP_IMG_INCLUDE_DIRS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# GIF detection, gifdec isn't part of the imageio lib.
|
# GIF detection, gifdec isn't part of the imageio lib.
|
||||||
include(CMakePushCheckState)
|
include(CMakePushCheckState)
|
||||||
set(WEBP_DEP_GIF_LIBRARIES)
|
set(WEBP_DEP_GIF_LIBRARIES)
|
||||||
set(WEBP_DEP_GIF_INCLUDE_DIRS)
|
set(WEBP_DEP_GIF_INCLUDE_DIRS)
|
||||||
find_package(GIF)
|
find_package(GIF)
|
||||||
set(WEBP_HAVE_GIF ${GIF_FOUND})
|
set(WEBP_HAVE_GIF ${GIF_FOUND})
|
||||||
if(GIF_FOUND)
|
if(GIF_FOUND)
|
||||||
# GIF find_package only locates the header and library, it doesn't fail
|
# GIF find_package only locates the header and library, it doesn't fail
|
||||||
# compile tests when detecting the version, but falls back to 3 (as of at
|
# compile tests when detecting the version, but falls back to 3 (as of at
|
||||||
# least cmake 3.7.2). Make sure the library links to avoid incorrect detection
|
# least cmake 3.7.2). Make sure the library links to avoid incorrect
|
||||||
# when cross compiling.
|
# detection when cross compiling.
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES})
|
set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES})
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR})
|
||||||
@ -122,6 +123,7 @@ if(GIF_FOUND)
|
|||||||
else()
|
else()
|
||||||
unset(GIF_FOUND)
|
unset(GIF_FOUND)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check for specific headers.
|
# Check for specific headers.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user