From a495bbb967926f10411949707a9a4f3bda99da44 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 12:59:56 +0400 Subject: [PATCH 1/8] Added a new file for recording minimal dependency versions. --- CMakeLists.txt | 2 ++ cmake/OpenCVMinDepVersions.cmake | 0 2 files changed, 2 insertions(+) create mode 100644 cmake/OpenCVMinDepVersions.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c1d3b292f..d743d59f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ # # ---------------------------------------------------------------------------- +include(cmake/OpenCVMinDepVersions.cmake) + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) # -------------------------------------------------------------- diff --git a/cmake/OpenCVMinDepVersions.cmake b/cmake/OpenCVMinDepVersions.cmake new file mode 100644 index 000000000..e69de29bb From a87756e9b393ecd6d4072eddda4bb158e5494fb9 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 13:29:07 +0400 Subject: [PATCH 2/8] Bumped minimal CMake version to 2.8.7. --- CMakeLists.txt | 26 ++++---------------------- cmake/OpenCVMinDepVersions.cmake | 1 + 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d743d59f3..335ef8a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,22 +4,14 @@ # From the off-tree build directory, invoke: # $ cmake # -# -# - OCT-2008: Initial version -# # ---------------------------------------------------------------------------- include(cmake/OpenCVMinDepVersions.cmake) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -# -------------------------------------------------------------- -# Indicate CMake 2.7 and above that we don't want to mix relative -# and absolute paths in linker lib lists. -# Run "cmake --help-policy CMP0003" for more information. -# -------------------------------------------------------------- -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) +if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3) + cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) +else() + cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR) endif() # Following block can broke build in case of cross-compilng @@ -43,16 +35,6 @@ else(NOT CMAKE_TOOLCHAIN_FILE) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") endif(NOT CMAKE_TOOLCHAIN_FILE) -# -------------------------------------------------------------- -# Top level OpenCV project -# -------------------------------------------------------------- -if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3) - cmake_minimum_required(VERSION 2.8.8) -elseif(IOS) - cmake_minimum_required(VERSION 2.8.0) -else() - cmake_minimum_required(VERSION 2.6.3) -endif() # must go before the project command set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) diff --git a/cmake/OpenCVMinDepVersions.cmake b/cmake/OpenCVMinDepVersions.cmake index e69de29bb..93ae5ebf6 100644 --- a/cmake/OpenCVMinDepVersions.cmake +++ b/cmake/OpenCVMinDepVersions.cmake @@ -0,0 +1 @@ +set(MIN_VER_CMAKE 2.8.7) From 168e2a4ccb1a6fdcddaa5337a415aba2f347f59b Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 13:55:49 +0400 Subject: [PATCH 3/8] Removed CMake version checks that we don't need anymore. --- 3rdparty/tbb/CMakeLists.txt | 14 +------------- CMakeLists.txt | 12 ++++++------ cmake/OpenCVConfig.cmake | 13 ++++--------- cmake/OpenCVDetectAndroidSDK.cmake | 2 +- cmake/OpenCVDetectCUDA.cmake | 5 ----- cmake/OpenCVFindLibsGUI.cmake | 2 +- modules/highgui/CMakeLists.txt | 5 ----- 7 files changed, 13 insertions(+), 40 deletions(-) diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index c728440f2..d460837f8 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -83,19 +83,7 @@ set(tbb_tarball "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_ver}_src.tgz") set(tbb_src_dir "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}") macro(getMD5 filename varname) - if(CMAKE_VERSION VERSION_GREATER 2.8.6) - file(MD5 "${filename}" ${varname}) - else() - execute_process(COMMAND ${CMAKE_COMMAND} -E md5sum "${filename}" - RESULT_VARIABLE getMD5_RESULT - OUTPUT_VARIABLE getMD5_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(getMD5_RESULT EQUAL 0) - string(REGEX MATCH "^[a-z0-9]+" ${varname} "${getMD5_OUTPUT}") - else() - set(${varname} "invalid_md5") - endif() - endif() + file(MD5 "${filename}" ${varname}) endmacro() if(EXISTS "${tbb_tarball}") diff --git a/CMakeLists.txt b/CMakeLists.txt index 335ef8a99..3bd684327 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ endif(NOT CMAKE_TOOLCHAIN_FILE) # must go before the project command set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) -if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") +if(DEFINED CMAKE_BUILD_TYPE) set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) endif() @@ -110,10 +110,10 @@ endif() OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS) OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE ) -OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) ) +OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT ANDROID AND NOT IOS AND NOT APPLE) ) OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON) OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 ) OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS)) @@ -184,7 +184,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi # OpenCV build options # =================================================== OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) ) -OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") ) +OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) ) OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX) ) OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) ) diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake index 300fcd419..8e3708dd3 100644 --- a/cmake/OpenCVConfig.cmake +++ b/cmake/OpenCVConfig.cmake @@ -38,11 +38,9 @@ # - OpenCV_STATIC # - OpenCV_CUDA -if(CMAKE_VERSION VERSION_GREATER 2.6) - get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) - if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;") - enable_language(CXX) - endif() +get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;") + enable_language(CXX) endif() if(NOT DEFINED OpenCV_STATIC) @@ -92,9 +90,7 @@ elseif(MINGW) endif() endif() -if(CMAKE_VERSION VERSION_GREATER 2.6.2) - unset(OpenCV_CONFIG_PATH CACHE) -endif() +unset(OpenCV_CONFIG_PATH CACHE) get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) if(OpenCV_RUNTIME AND OpenCV_ARCH) @@ -156,4 +152,3 @@ else() set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE) set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE) endif() - diff --git a/cmake/OpenCVDetectAndroidSDK.cmake b/cmake/OpenCVDetectAndroidSDK.cmake index ee4188897..68be77619 100644 --- a/cmake/OpenCVDetectAndroidSDK.cmake +++ b/cmake/OpenCVDetectAndroidSDK.cmake @@ -124,7 +124,7 @@ if(ANDROID_EXECUTABLE) if(NOT ANDROID_SDK_TARGET) set(ANDROID_SDK_TARGET "" CACHE STRING "Android SDK target for the OpenCV Java API and samples") endif() - if(ANDROID_SDK_TARGETS AND CMAKE_VERSION VERSION_GREATER "2.8") + if(ANDROID_SDK_TARGETS) set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} ) endif() endif(ANDROID_EXECUTABLE) diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index 1e561a32e..076da108f 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -1,8 +1,3 @@ -if(${CMAKE_VERSION} VERSION_LESS "2.8.3") - message(STATUS "WITH_CUDA flag requires CMake 2.8.3 or newer. CUDA support is disabled.") - return() -endif() - if(WIN32 AND NOT MSVC) message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).") return() diff --git a/cmake/OpenCVFindLibsGUI.cmake b/cmake/OpenCVFindLibsGUI.cmake index 04c77d8ec..89982b262 100644 --- a/cmake/OpenCVFindLibsGUI.cmake +++ b/cmake/OpenCVFindLibsGUI.cmake @@ -15,7 +15,7 @@ endif(WITH_WIN32UI) # --- QT4 --- ocv_clear_vars(HAVE_QT HAVE_QT5) if(WITH_QT) - if(NOT CMAKE_VERSION VERSION_LESS 2.8.3 AND NOT WITH_QT EQUAL 4) + if(NOT WITH_QT EQUAL 4) find_package(Qt5Core) find_package(Qt5Gui) find_package(Qt5Widgets) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 4a748df55..dbea6ec1c 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -293,11 +293,6 @@ if(WIN32 AND WITH_FFMPEG) set(ffmpeg_bare_name_ver "opencv_ffmpeg${OPENCV_DLLVERSION}${FFMPEG_SUFFIX}.dll") set(ffmpeg_path "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/${ffmpeg_bare_name}") - #if(MSVC AND CMAKE_VERSION VERSION_GREATER "2.8.2") - # add_custom_command(TARGET ${the_module} POST_BUILD - # COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/$/${ffmpeg_bare_name_ver}" - # COMMENT "Copying ${ffmpeg_path} to the output directory") - #else if(MSVC_IDE) add_custom_command(TARGET ${the_module} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name_ver}" From 656416d174805c9dd33172b9060d7b4dc080aacf Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 13:58:39 +0400 Subject: [PATCH 4/8] Dropped OpenCVConfig.cmake - we don't use it anymore. --- cmake/OpenCVConfig.cmake | 154 --------------------------------------- 1 file changed, 154 deletions(-) delete mode 100644 cmake/OpenCVConfig.cmake diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake deleted file mode 100644 index 8e3708dd3..000000000 --- a/cmake/OpenCVConfig.cmake +++ /dev/null @@ -1,154 +0,0 @@ -# =================================================================================== -# The OpenCV CMake configuration file -# -# ** File generated automatically, do not modify ** -# -# Usage from an external project: -# In your CMakeLists.txt, add these lines: -# -# FIND_PACKAGE(OpenCV REQUIRED) -# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS}) -# -# Or you can search for specific OpenCV modules: -# -# FIND_PACKAGE(OpenCV REQUIRED core highgui) -# -# If the module is found then OPENCV__FOUND is set to TRUE. -# -# This file will define the following variables: -# - OpenCV_LIBS : The list of libraries to links against. -# - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES -# with this path is NOT needed. -# - OpenCV_INCLUDE_DIRS : The OpenCV include directories. -# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability -# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API -# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0" -# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2" -# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4" -# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0" -# -# Advanced variables: -# - OpenCV_SHARED -# - OpenCV_CONFIG_PATH -# - OpenCV_LIB_COMPONENTS -# -# =================================================================================== -# -# Windows pack specific options: -# - OpenCV_STATIC -# - OpenCV_CUDA - -get_property(OpenCV_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT ";${OpenCV_LANGUAGES};" MATCHES ";CXX;") - enable_language(CXX) -endif() - -if(NOT DEFINED OpenCV_STATIC) - # look for global setting - if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) - set(OpenCV_STATIC OFF) - else() - set(OpenCV_STATIC ON) - endif() -endif() - -if(NOT DEFINED OpenCV_CUDA) - # if user' app uses CUDA, then it probably wants CUDA-enabled OpenCV binaries - if(CUDA_FOUND) - set(OpenCV_CUDA ON) - endif() -endif() - -if(MSVC) - if(CMAKE_CL_64) - set(OpenCV_ARCH x64) - set(OpenCV_TBB_ARCH intel64) - else() - set(OpenCV_ARCH x86) - set(OpenCV_TBB_ARCH ia32) - endif() - if(MSVC_VERSION EQUAL 1400) - set(OpenCV_RUNTIME vc8) - elseif(MSVC_VERSION EQUAL 1500) - set(OpenCV_RUNTIME vc9) - elseif(MSVC_VERSION EQUAL 1600) - set(OpenCV_RUNTIME vc10) - elseif(MSVC_VERSION EQUAL 1700) - set(OpenCV_RUNTIME vc11) - endif() -elseif(MINGW) - set(OpenCV_RUNTIME mingw) - - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine - OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64") - set(MINGW64 1) - set(OpenCV_ARCH x64) - else() - set(OpenCV_ARCH x86) - endif() -endif() - -unset(OpenCV_CONFIG_PATH CACHE) - -get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) -if(OpenCV_RUNTIME AND OpenCV_ARCH) - if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") - if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") - set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") - else() - set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib") - endif() - elseif(EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake") - if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVConfig.cmake") - set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") - else() - set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib") - endif() - endif() -endif() - -if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake") - set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE) - set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE) - set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdpaty OpenCV dependencies are located" FORCE) - set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdpaty OpenCV dependencies are located" FORCE) - - include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake") - - if(OpenCV_CUDA) - set(_OpenCV_LIBS "") - foreach(_lib ${OpenCV_LIBS}) - string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}") - if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}") - list(APPEND _OpenCV_LIBS "${_lib2}") - else() - list(APPEND _OpenCV_LIBS "${_lib}") - endif() - endforeach() - set(OpenCV_LIBS ${_OpenCV_LIBS}) - endif() - set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE) - set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE) - - if(NOT OpenCV_FIND_QUIETLY) - message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}") - if(NOT OpenCV_LIB_PATH MATCHES "/staticlib") - get_filename_component(_OpenCV_LIB_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE) - file(TO_NATIVE_PATH "${_OpenCV_LIB_PATH}" _OpenCV_LIB_PATH) - message(STATUS "You might need to add ${_OpenCV_LIB_PATH} to your PATH to be able to run your applications.") - if(OpenCV_LIB_PATH MATCHES "/gpu/") - string(REPLACE "\\gpu" "" _OpenCV_LIB_PATH2 "${_OpenCV_LIB_PATH}") - message(STATUS "GPU support is enabled so you might also need ${_OpenCV_LIB_PATH2} in your PATH (it must go after the ${_OpenCV_LIB_PATH}).") - endif() - endif() - endif() -else() - if(NOT OpenCV_FIND_QUIETLY) - message(WARNING "Found OpenCV 2.4.3 Windows Super Pack but it has not binaries compatible with your configuration. - You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.") - endif() - set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE) - set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE) -endif() From a23abef9bd241cc7383dce8dae8a8b592ddf137c Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 14:37:22 +0400 Subject: [PATCH 5/8] Removed OpenCVFindPkgConfig.cmake, since it's bundled with CMake now. In fact, I don't think we actually use it... but I kept the include, just in case. --- CMakeLists.txt | 2 +- cmake/OpenCVFindPkgConfig.cmake | 365 -------------------------------- 2 files changed, 1 insertion(+), 366 deletions(-) delete mode 100644 cmake/OpenCVFindPkgConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bd684327..5e25f16cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,7 +346,7 @@ endif(WIN32 AND NOT MINGW) # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC.. # ---------------------------------------------------------------------------- if(UNIX) - include(cmake/OpenCVFindPkgConfig.cmake OPTIONAL) + find_package(PkgConfig QUIET) include(CheckFunctionExists) include(CheckIncludeFile) diff --git a/cmake/OpenCVFindPkgConfig.cmake b/cmake/OpenCVFindPkgConfig.cmake deleted file mode 100644 index 7e439fd8d..000000000 --- a/cmake/OpenCVFindPkgConfig.cmake +++ /dev/null @@ -1,365 +0,0 @@ -# -# OpenCV note: the file has been extracted from CMake 2.6.2 distribution. -# It is used to build OpenCV with CMake 2.4.x -# - -# - a pkg-config module for CMake -# -# Usage: -# pkg_check_modules( [REQUIRED] []*) -# checks for all the given modules -# -# pkg_search_module( [REQUIRED] []*) -# checks for given modules and uses the first working one -# -# When the 'REQUIRED' argument was set, macros will fail with an error -# when module(s) could not be found -# -# It sets the following variables: -# PKG_CONFIG_FOUND ... true if pkg-config works on the system -# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program -# _FOUND ... set to 1 if module(s) exist -# -# For the following variables two sets of values exist; first one is the -# common one and has the given PREFIX. The second set contains flags -# which are given out when pkgconfig was called with the '--static' -# option. -# _LIBRARIES ... only the libraries (w/o the '-l') -# _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') -# _LDFLAGS ... all required linker flags -# _LDFLAGS_OTHER ... all other linker flags -# _INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') -# _CFLAGS ... all required cflags -# _CFLAGS_OTHER ... the other compiler flags -# -# = for common case -# = _STATIC for static linking -# -# There are some special variables whose prefix depends on the count -# of given modules. When there is only one module, stays -# unchanged. When there are multiple modules, the prefix will be -# changed to _: -# _VERSION ... version of the module -# _PREFIX ... prefix-directory of the module -# _INCLUDEDIR ... include-dir of the module -# _LIBDIR ... lib-dir of the module -# -# = when |MODULES| == 1, else -# = _ -# -# A parameter can have the following formats: -# {MODNAME} ... matches any version -# {MODNAME}>={VERSION} ... at least version is required -# {MODNAME}={VERSION} ... exactly version is required -# {MODNAME}<={VERSION} ... modules must not be newer than -# -# Examples -# pkg_check_modules (GLIB2 glib-2.0) -# -# pkg_check_modules (GLIB2 glib-2.0>=2.10) -# requires at least version 2.10 of glib2 and defines e.g. -# GLIB2_VERSION=2.10.3 -# -# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) -# requires both glib2 and gtk2, and defines e.g. -# FOO_glib-2.0_VERSION=2.10.3 -# FOO_gtk+-2.0_VERSION=2.8.20 -# -# pkg_check_modules (XRENDER REQUIRED xrender) -# defines e.g.: -# XRENDER_LIBRARIES=Xrender;X11 -# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp -# -# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) - - -# Copyright (C) 2006 Enrico Scholz -# -# Redistribution and use, with or without modification, are permitted -# provided that the following conditions are met: -# -# 1. Redistributions must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -### Common stuff #### -set(PKG_CONFIG_VERSION 1) -set(PKG_CONFIG_FOUND 0) - -find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") -mark_as_advanced(PKG_CONFIG_EXECUTABLE) - -if(PKG_CONFIG_EXECUTABLE) - set(PKG_CONFIG_FOUND 1) -endif(PKG_CONFIG_EXECUTABLE) - - -# Unsets the given variables -macro(_pkgconfig_unset var) - set(${var} "" CACHE INTERNAL "") -endmacro(_pkgconfig_unset) - -macro(_pkgconfig_set var value) - set(${var} ${value} CACHE INTERNAL "") -endmacro(_pkgconfig_set) - -# Invokes pkgconfig, cleans up the result and sets variables -macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) - set(_pkgconfig_invoke_result) - - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} - OUTPUT_VARIABLE _pkgconfig_invoke_result - RESULT_VARIABLE _pkgconfig_failed) - - if (_pkgconfig_failed) - set(_pkgconfig_${_varname} "") - _pkgconfig_unset(${_prefix}_${_varname}) - else(_pkgconfig_failed) - string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - - if (NOT ${_regexp} STREQUAL "") - string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - endif(NOT ${_regexp} STREQUAL "") - - separate_arguments(_pkgconfig_invoke_result) - - #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}") - set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result}) - _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}") - endif(_pkgconfig_failed) -endmacro(_pkgconfig_invoke) - -# Invokes pkgconfig two times; once without '--static' and once with -# '--static' -macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) - _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN}) - _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN}) -endmacro(_pkgconfig_invoke_dyn) - -# Splits given arguments into options and a package list -macro(_pkgconfig_parse_options _result _is_req) - set(${_is_req} 0) - - foreach(_pkg ${ARGN}) - if (_pkg STREQUAL "REQUIRED") - set(${_is_req} 1) - endif (_pkg STREQUAL "REQUIRED") - endforeach(_pkg ${ARGN}) - - set(${_result} ${ARGN}) - list(REMOVE_ITEM ${_result} "REQUIRED") -endmacro(_pkgconfig_parse_options) - -### -macro(_pkg_check_modules_internal _is_required _is_silent _prefix) - _pkgconfig_unset(${_prefix}_FOUND) - _pkgconfig_unset(${_prefix}_VERSION) - _pkgconfig_unset(${_prefix}_PREFIX) - _pkgconfig_unset(${_prefix}_INCLUDEDIR) - _pkgconfig_unset(${_prefix}_LIBDIR) - _pkgconfig_unset(${_prefix}_LIBS) - _pkgconfig_unset(${_prefix}_LIBS_L) - _pkgconfig_unset(${_prefix}_LIBS_PATHS) - _pkgconfig_unset(${_prefix}_LIBS_OTHER) - _pkgconfig_unset(${_prefix}_CFLAGS) - _pkgconfig_unset(${_prefix}_CFLAGS_I) - _pkgconfig_unset(${_prefix}_CFLAGS_OTHER) - _pkgconfig_unset(${_prefix}_STATIC_LIBDIR) - _pkgconfig_unset(${_prefix}_STATIC_LIBS) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_L) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS) - _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I) - _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER) - - # create a better addressable variable of the modules and calculate its size - set(_pkg_check_modules_list ${ARGN}) - list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt) - - if(PKG_CONFIG_EXECUTABLE) - # give out status message telling checked module - if (NOT ${_is_silent}) - if (_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for module '${_pkg_check_modules_list}'") - else(_pkg_check_modules_cnt EQUAL 1) - message(STATUS "checking for modules '${_pkg_check_modules_list}'") - endif(_pkg_check_modules_cnt EQUAL 1) - endif(NOT ${_is_silent}) - - set(_pkg_check_modules_packages) - set(_pkg_check_modules_failed) - - # iterate through module list and check whether they exist and match the required version - foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) - set(_pkg_check_modules_exist_query) - - # check whether version is given - if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") - else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") - set(_pkg_check_modules_pkg_op) - set(_pkg_check_modules_pkg_ver) - endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - - # handle the operands - if (_pkg_check_modules_pkg_op STREQUAL ">=") - list(APPEND _pkg_check_modules_exist_query --atleast-version) - endif(_pkg_check_modules_pkg_op STREQUAL ">=") - - if (_pkg_check_modules_pkg_op STREQUAL "=") - list(APPEND _pkg_check_modules_exist_query --exact-version) - endif(_pkg_check_modules_pkg_op STREQUAL "=") - - if (_pkg_check_modules_pkg_op STREQUAL "<=") - list(APPEND _pkg_check_modules_exist_query --max-version) - endif(_pkg_check_modules_pkg_op STREQUAL "<=") - - # create the final query which is of the format: - # * --atleast-version - # * --exact-version - # * --max-version - # * --exists - if (_pkg_check_modules_pkg_op) - list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") - else(_pkg_check_modules_pkg_op) - list(APPEND _pkg_check_modules_exist_query --exists) - endif(_pkg_check_modules_pkg_op) - - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR) - _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR) - - list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}") - list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}") - - # execute the query - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} - RESULT_VARIABLE _pkgconfig_retval) - - # evaluate result and tell failures - if (_pkgconfig_retval) - if(NOT ${_is_silent}) - message(STATUS " package '${_pkg_check_modules_pkg}' not found") - endif(NOT ${_is_silent}) - - set(_pkg_check_modules_failed 1) - endif(_pkgconfig_retval) - endforeach(_pkg_check_modules_pkg) - - if(_pkg_check_modules_failed) - # fail when requested - if (${_is_required}) - message(SEND_ERROR "A required package was not found") - endif (${_is_required}) - else(_pkg_check_modules_failed) - # when we are here, we checked whether requested modules - # exist. Now, go through them and set variables - - _pkgconfig_set(${_prefix}_FOUND 1) - list(LENGTH _pkg_check_modules_packages pkg_count) - - # iterate through all modules again and set individual variables - foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages}) - # handle case when there is only one package required - if (pkg_count EQUAL 1) - set(_pkg_check_prefix "${_prefix}") - else(pkg_count EQUAL 1) - set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") - endif(pkg_count EQUAL 1) - - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) - - message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") - endforeach(_pkg_check_modules_pkg) - - # set variables which are combined for multiple modules - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) - - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) - endif(_pkg_check_modules_failed) - else(PKG_CONFIG_EXECUTABLE) - if (${_is_required}) - message(SEND_ERROR "pkg-config tool not found") - endif (${_is_required}) - endif(PKG_CONFIG_EXECUTABLE) -endmacro(_pkg_check_modules_internal) - -### -### User visible macros start here -### - -### -macro(pkg_check_modules _prefix _module0) - # check cached value - if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) - _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN}) - _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules}) - - _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) -endmacro(pkg_check_modules) - -### -macro(pkg_search_module _prefix _module0) - # check cached value - if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) - set(_pkg_modules_found 0) - _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN}) - - message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") - - # iterate through all modules and stop at the first working one. - foreach(_pkg_alt ${_pkg_modules_alt}) - if(NOT _pkg_modules_found) - _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") - endif(NOT _pkg_modules_found) - - if (${_prefix}_FOUND) - set(_pkg_modules_found 1) - endif(${_prefix}_FOUND) - endforeach(_pkg_alt) - - if (NOT ${_prefix}_FOUND) - if(${_pkg_is_required}) - message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") - endif(${_pkg_is_required}) - endif(NOT ${_prefix}_FOUND) - - _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) -endmacro(pkg_search_module) - -### Local Variables: -### mode: cmake -### End: From 36874300c83b5ba06db27805bce764d15c4aaf8e Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 22 Jul 2013 14:39:56 +0400 Subject: [PATCH 6/8] Removed CMakeParseArguments.cmake, which we don't use. It's part of CMake nowadays, too. --- cmake/CMakeParseArguments.cmake | 138 -------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 cmake/CMakeParseArguments.cmake diff --git a/cmake/CMakeParseArguments.cmake b/cmake/CMakeParseArguments.cmake deleted file mode 100644 index 7ce4c49ae..000000000 --- a/cmake/CMakeParseArguments.cmake +++ /dev/null @@ -1,138 +0,0 @@ -# CMAKE_PARSE_ARGUMENTS( args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for -# parsing the arguments given to that macro or function. -# It processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any value -# following, like e.g. the OPTIONAL keyword of the install() command. -# -# The argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The argument contains all keywords for this macro -# which can be followed by more than one value, like e.g. the TARGETS or -# FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in , and -# a variable composed of the given -# followed by "_" and the name of the respective keyword. -# These variables will then hold the respective value from the argument list. -# For the keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# _UNPARSED_ARGUMENTS, this can be checked afterwards to see whether -# your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments as the -# real install() command: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) -# ... -# -# Assume my_install() has been called like this: -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# After the cmake_parse_arguments() call the macro will have set the following -# variables: -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# You can the continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a one_value_keyword -# another recognized keyword follows, this is interpreted as the beginning of -# the new option. -# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would -# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. - -#============================================================================= -# Copyright 2010 Alexander Neundorf -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach(arg_name) - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach(option) - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if("${insideValues}" STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif("${insideValues}" STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else(insideValues) - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif(insideValues) - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach(currentArg) - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach(arg_name) - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) From e57407849a94fcdde0a500feed0d5e73e9adbd3e Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 7 Aug 2013 14:45:44 +0400 Subject: [PATCH 7/8] Removed obsolete CMake workaround. --- cmake/OpenCVFindLibsGrfmt.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index bd62264b4..8b6c25a08 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -199,8 +199,3 @@ if(WITH_OPENEXR) set(HAVE_OPENEXR YES) endif() - -#cmake 2.8.2 bug - it fails to determine zlib version -if(ZLIB_FOUND) - ocv_parse_header2(ZLIB "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_VERSION) -endif() From afc6f79038522244b8b1149a2cd8e979945f1ccd Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 12 Aug 2013 15:38:58 +0400 Subject: [PATCH 8/8] Inlined the getMD5 macro, which no longer saves us anything. --- 3rdparty/tbb/CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index d460837f8..4e510ffa3 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -82,12 +82,8 @@ endif() set(tbb_tarball "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_ver}_src.tgz") set(tbb_src_dir "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}") -macro(getMD5 filename varname) - file(MD5 "${filename}" ${varname}) -endmacro() - if(EXISTS "${tbb_tarball}") - getMD5("${tbb_tarball}" tbb_local_md5) + file(MD5 "${tbb_tarball}" tbb_local_md5) if(NOT tbb_local_md5 STREQUAL tbb_md5) message(WARNING "Local copy of TBB source tarball has invalid MD5 hash: ${tbb_local_md5} (expected: ${tbb_md5})") file(REMOVE "${tbb_tarball}") @@ -103,7 +99,7 @@ if(NOT EXISTS "${tbb_tarball}") if(NOT __statvar EQUAL 0) message(FATAL_ERROR "Failed to download TBB sources: ${tbb_url}") endif() - getMD5("${tbb_tarball}" tbb_local_md5) + file(MD5 "${tbb_tarball}" tbb_local_md5) if(NOT tbb_local_md5 STREQUAL tbb_md5) file(REMOVE "${tbb_tarball}") message(FATAL_ERROR "Downloaded TBB source tarball has invalid MD5 hash: ${tbb_local_md5} (expected: ${tbb_md5})")