mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Merge "cmake: fix gif lib detection when cross compiling"
This commit is contained in:
commit
87f57a4b62
@ -75,13 +75,34 @@ foreach(I_LIB PNG JPEG TIFF)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# GIF detection, gifdec isn't part of the imageio lib.
|
# GIF detection, gifdec isn't part of the imageio lib.
|
||||||
|
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
|
||||||
|
# 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 when cross compiling.
|
||||||
|
cmake_push_check_state()
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${GIF_LIBRARIES})
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${GIF_INCLUDE_DIR})
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <gif_lib.h>
|
||||||
|
int main(void) {
|
||||||
|
(void)DGifOpenFileHandle;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
" GIF_COMPILES
|
||||||
|
)
|
||||||
|
cmake_pop_check_state()
|
||||||
|
if(GIF_COMPILES)
|
||||||
list(APPEND WEBP_DEP_GIF_LIBRARIES ${GIF_LIBRARIES})
|
list(APPEND WEBP_DEP_GIF_LIBRARIES ${GIF_LIBRARIES})
|
||||||
list(APPEND WEBP_DEP_GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
|
list(APPEND WEBP_DEP_GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
unset(GIF_FOUND)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Check for specific headers.
|
## Check for specific headers.
|
||||||
|
Loading…
Reference in New Issue
Block a user