From 1b526638b8bf4c41f49a38e9d8f019bad63bccb1 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Fri, 7 Jul 2017 10:33:48 +0200 Subject: [PATCH] Clean-up some CMake - some image libraries define _INCLUDE_DIR and not INCLUDE_DIRS. - CMakePushCheckState is a non-destructive way of changing the CMAKE_REQUIRED_* variables. Change-Id: I7d318a0ddf9754a5c047f47ba1713f9f94e1ec1c --- cmake/config.h.cmake | 6 +++++- cmake/cpu.cmake | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 693fa5f0..83ee08bd 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -70,9 +70,13 @@ foreach(I_LIB PNG JPEG TIFF) set(WEBP_HAVE_${I_LIB} ${${I_LIB}_FOUND}) if(${I_LIB}_FOUND) list(APPEND WEBP_DEP_IMG_LIBRARIES ${${I_LIB}_LIBRARIES}) - list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS ${${I_LIB}_INCLUDE_DIRS}) + list(APPEND WEBP_DEP_IMG_INCLUDE_DIRS + ${${I_LIB}_INCLUDE_DIR} ${${I_LIB}_INCLUDE_DIRS}) endif() endforeach() +if(WEBP_DEP_IMG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES WEBP_DEP_IMG_INCLUDE_DIRS) +endif() # GIF detection, gifdec isn't part of the imageio lib. include(CMakePushCheckState) diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake index 466a8b63..ae9f17e9 100644 --- a/cmake/cpu.cmake +++ b/cmake/cpu.cmake @@ -54,12 +54,14 @@ endif() list(LENGTH WEBP_SIMD_FLAGS WEBP_SIMD_FLAGS_LENGTH) math(EXPR WEBP_SIMD_FLAGS_RANGE "${WEBP_SIMD_FLAGS_LENGTH} - 1") +include(CMakePushCheckState) foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE}) list(GET WEBP_SIMD_FLAGS ${I_SIMD} WEBP_SIMD_FLAG) # First try with no extra flag added as the compiler might have default flags # (especially on Android). unset(WEBP_HAVE_${WEBP_SIMD_FLAG} CACHE) + cmake_push_check_state() set(CMAKE_REQUIRED_FLAGS) webp_check_compiler_flag(${WEBP_SIMD_FLAG} ${WEBP_ENABLE_SIMD}) if(NOT WEBP_HAVE_${WEBP_SIMD_FLAG}) @@ -116,4 +118,5 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE}) endif() endif() endif() + cmake_pop_check_state() endforeach()