From 6fed0e85c22b71e1fa070d962447d34cae5e0269 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 22 Aug 2013 18:04:50 +0400 Subject: [PATCH] Cut down on the use of ZLIB_LIBRARY/ZLIB_INCLUDE_DIR. They're not listed in the documentation for the FindZLIB module, so we shouldn't use them unless necessary. --- 3rdparty/libpng/CMakeLists.txt | 4 ++-- 3rdparty/libtiff/CMakeLists.txt | 2 +- 3rdparty/openexr/CMakeLists.txt | 2 +- CMakeLists.txt | 2 +- cmake/OpenCVFindLibsGrfmt.cmake | 9 ++++----- modules/core/CMakeLists.txt | 2 +- modules/highgui/CMakeLists.txt | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 59dca6990e..141c9d1518 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -9,7 +9,7 @@ else() project(${PNG_LIBRARY}) endif() -ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR}) +ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIRS}) file(GLOB lib_srcs *.c) file(GLOB lib_hdrs *.h) @@ -34,7 +34,7 @@ if (HAVE_WINRT) endif() add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) -target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARY}) +target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) if(UNIX) if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 46fef61c7d..f779210815 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -24,7 +24,7 @@ endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmakein" "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" @ONLY) -ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIR}) +ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS}) set(lib_srcs tif_aux.c diff --git a/3rdparty/openexr/CMakeLists.txt b/3rdparty/openexr/CMakeLists.txt index 3d4cc689f9..e10b940079 100644 --- a/3rdparty/openexr/CMakeLists.txt +++ b/3rdparty/openexr/CMakeLists.txt @@ -22,7 +22,7 @@ set(OPENEXR_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Half" "${CMAKE_CURRENT_SOURCE_DIR}/Imath" "${CMAKE_CURRENT_SOURCE_DIR}/IlmImf") -ocv_include_directories("${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIR} ${OPENEXR_INCLUDE_PATHS}) +ocv_include_directories("${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS} ${OPENEXR_INCLUDE_PATHS}) file(GLOB lib_srcs Half/half.cpp Iex/*.cpp IlmThread/*.cpp Imath/*.cpp IlmImf/*.cpp) file(GLOB lib_hdrs Half/*.h Iex/Iex*.h IlmThread/IlmThread*.h Imath/Imath*.h IlmImf/*.h) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c498cd37a..239e5e0fe8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -631,7 +631,7 @@ status(" OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE N # ========================== MEDIA IO ========================== status("") status(" Media I/O: ") -status(" ZLib:" BUILD_ZLIB THEN "build (ver ${ZLIB_VERSION_STRING})" ELSE "${ZLIB_LIBRARY} (ver ${ZLIB_VERSION_STRING})") +status(" ZLib:" BUILD_ZLIB THEN "build (ver ${ZLIB_VERSION_STRING})" ELSE "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})") if(WITH_JPEG) status(" JPEG:" JPEG_FOUND THEN "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})" ELSE "build (ver ${JPEG_LIB_VERSION})") diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index 8b6c25a083..ea970edcc7 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -8,20 +8,19 @@ if(BUILD_ZLIB) else() include(FindZLIB) if(ZLIB_FOUND AND ANDROID) - if(ZLIB_LIBRARY STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so") - set(ZLIB_LIBRARY z) + if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so") set(ZLIB_LIBRARIES z) endif() endif() endif() if(NOT ZLIB_FOUND) - ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIR) + ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) set(ZLIB_LIBRARY zlib) - set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/zlib") - set(ZLIB_INCLUDE_DIR "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}") + set(ZLIB_INCLUDE_DIRS "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}") + set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) ocv_parse_header2(ZLIB "${${ZLIB_LIBRARY}_SOURCE_DIR}/zlib.h" ZLIB_VERSION) endif() diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index baa287bca7..b83a591490 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -1,6 +1,6 @@ set(the_description "The Core Functionality") ocv_add_module(core ${ZLIB_LIBRARIES} OPTIONAL opencv_cudev) -ocv_module_include_directories(${ZLIB_INCLUDE_DIR}) +ocv_module_include_directories(${ZLIB_INCLUDE_DIRS}) if (HAVE_WINRT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"") diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 3737d25d83..011bb0dc33 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -10,7 +10,7 @@ ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera) ocv_clear_vars(GRFMT_LIBS) if(HAVE_PNG OR HAVE_TIFF OR HAVE_OPENEXR) - ocv_include_directories(${ZLIB_INCLUDE_DIR}) + ocv_include_directories(${ZLIB_INCLUDE_DIRS}) list(APPEND GRFMT_LIBS ${ZLIB_LIBRARIES}) endif()