From 0d747daf47b256187cb4445d87c40625c0406992 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 15 Apr 2019 21:29:17 +0000 Subject: [PATCH] cmake: use absolute library paths from 'pkgconfig' - drop legacy check_module() macro - drop 'ALIASOF_' --- CMakeLists.txt | 22 +++---- cmake/OpenCVFindLibsGUI.cmake | 24 +++++--- cmake/OpenCVFindLibsPerf.cmake | 5 +- cmake/OpenCVFindLibsVideo.cmake | 102 ++++++++++++++++--------------- cmake/OpenCVUtils.cmake | 67 +++++++++++++------- modules/highgui/CMakeLists.txt | 4 +- modules/imgcodecs/CMakeLists.txt | 4 +- modules/videoio/CMakeLists.txt | 4 +- 8 files changed, 132 insertions(+), 100 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c639e6067c..759de6ece6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1326,15 +1326,15 @@ endif() if(WITH_GTK OR HAVE_GTK) if(HAVE_GTK3) - status(" GTK+:" "YES (ver ${ALIASOF_gtk+-3.0_VERSION})") + status(" GTK+:" "YES (ver ${GTK3_VERSION})") elseif(HAVE_GTK) - status(" GTK+:" "YES (ver ${ALIASOF_gtk+-2.0_VERSION})") + status(" GTK+:" "YES (ver ${GTK2_VERSION})") else() status(" GTK+:" "NO") endif() if(HAVE_GTK) - status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO) - status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO) + status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VERSION})" ELSE NO) + status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO) endif() endif() @@ -1411,9 +1411,9 @@ endif() if(WITH_1394 OR HAVE_DC1394) if (HAVE_DC1394_2) - status(" DC1394:" "YES (ver ${ALIASOF_libdc1394-2_VERSION})") + status(" DC1394:" "YES (ver ${DC1394_2_VERSION})") elseif (HAVE_DC1394) - status(" DC1394:" "YES (ver ${ALIASOF_libdc1394_VERSION})") + status(" DC1394:" "YES (ver ${DC1394_VERSION})") else() status(" DC1394:" "NO") endif() @@ -1435,7 +1435,7 @@ if(WITH_FFMPEG OR HAVE_FFMPEG) endif() if(WITH_GSTREAMER OR HAVE_GSTREAMER) - status(" GStreamer:" HAVE_GSTREAMER THEN "" ELSE NO) + status(" GStreamer:" HAVE_GSTREAMER THEN "YES" ELSE NO) if(HAVE_GSTREAMER) status(" base:" "YES (ver ${GSTREAMER_BASE_VERSION})") status(" video:" "YES (ver ${GSTREAMER_VIDEO_VERSION})") @@ -1477,12 +1477,12 @@ if(APPLE) endif() if(WITH_UNICAP OR HAVE_UNICAP) - status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${ALIASOF_libunicap_VERSION})" ELSE NO) - status(" UniCap ucil:" HAVE_UNICAP_UCIL THEN "YES (ver ${ALIASOF_libucil_VERSION})" ELSE NO) + status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${UNICAP_libunicap_VERSION})" ELSE NO) + status(" UniCap ucil:" HAVE_UNICAP THEN "YES (ver ${UNICAP_libucil_VERSION})" ELSE NO) endif() if(WITH_V4L OR WITH_LIBV4L OR HAVE_LIBV4L OR HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO) - status(" libv4l/libv4l2:" HAVE_LIBV4L THEN "${ALIASOF_libv4l1_VERSION} / ${ALIASOF_libv4l2_VERSION}" ELSE "NO") + status(" libv4l/libv4l2:" HAVE_LIBV4L THEN "${LIBV4L_libv4l1_VERSION} / ${LIBV4L_libv4l2_VERSION}" ELSE "NO") ocv_build_features_string(v4l_status IF HAVE_CAMV4L THEN "linux/videodev.h" IF HAVE_CAMV4L2 THEN "linux/videodev2.h" @@ -1505,7 +1505,7 @@ if(WITH_XIMEA OR HAVE_XIMEA) endif() if(WITH_XINE OR HAVE_XINE) - status(" Xine:" HAVE_XINE THEN "YES (ver ${ALIASOF_libxine_VERSION})" ELSE NO) + status(" Xine:" HAVE_XINE THEN "YES (ver ${XINE_VERSION})" ELSE NO) endif() if(WITH_INTELPERC OR HAVE_INTELPERC) diff --git a/cmake/OpenCVFindLibsGUI.cmake b/cmake/OpenCVFindLibsGUI.cmake index efabb3ce15..5f861896b5 100644 --- a/cmake/OpenCVFindLibsGUI.cmake +++ b/cmake/OpenCVFindLibsGUI.cmake @@ -42,24 +42,34 @@ endif() ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT) if(WITH_GTK AND NOT HAVE_QT) if(NOT WITH_GTK_2_X) - CHECK_MODULE(gtk+-3.0 HAVE_GTK3 HIGHGUI) + ocv_check_modules(GTK3 gtk+-3.0) if(HAVE_GTK3) + ocv_append_build_options(HIGHGUI GTK3) set(HAVE_GTK TRUE) endif() endif() if(NOT HAVE_GTK) - CHECK_MODULE(gtk+-2.0 HAVE_GTK HIGHGUI) - if(HAVE_GTK AND (ALIASOF_gtk+-2.0_VERSION VERSION_LESS MIN_VER_GTK)) - message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)") - set(HAVE_GTK FALSE) + ocv_check_modules(GTK2 gtk+-2.0) + if(HAVE_GTK2) + if (GTK2_VERSION VERSION_LESS MIN_VER_GTK) + message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${GTK2_VERSION} found)") + else() + ocv_append_build_options(HIGHGUI GTK2) + set(HAVE_GTK TRUE) + endif() endif() endif() - CHECK_MODULE(gthread-2.0 HAVE_GTHREAD HIGHGUI) + ocv_check_modules(GTHREAD gthread-2.0) if(HAVE_GTK AND NOT HAVE_GTHREAD) message(FATAL_ERROR "gthread not found. This library is required when building with GTK support") + else() + ocv_append_build_options(HIGHGUI GTHREAD) endif() if(WITH_OPENGL AND NOT HAVE_GTK3) - CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT HIGHGUI) + ocv_check_modules(GTKGLEXT gtkglext-1.0) + if(HAVE_GTKGLEXT) + ocv_append_build_options(GTKGLEXT GTHREAD) + endif() endif() endif() diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake index 8b91a2d739..67978f9210 100644 --- a/cmake/OpenCVFindLibsPerf.cmake +++ b/cmake/OpenCVFindLibsPerf.cmake @@ -59,14 +59,13 @@ endif(WITH_EIGEN) ocv_clear_vars(HAVE_CLP) if(WITH_CLP) if(UNIX) - PKG_CHECK_MODULES(CLP clp) + ocv_check_modules(CLP clp) if(CLP_FOUND) set(HAVE_CLP TRUE) if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "") ocv_include_directories(${CLP_INCLUDE_DIRS}) endif() - link_directories(${CLP_LIBRARY_DIRS}) - set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES}) + list(APPEND OPENCV_LINKER_LIBS ${CLP_LIBRARIES}) endif() endif() diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index c9f593fbda..b9cc02d05c 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -27,50 +27,41 @@ if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10) ENDIF(GSTREAMER_gstbase_LIBRARY AND GSTREAMER_gstvideo_LIBRARY AND GSTREAMER_gstapp_LIBRARY AND GSTREAMER_gstpbutils_LIBRARY AND GSTREAMER_gstriff_LIBRARY) else(WIN32) - CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE VIDEOIO) - CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO VIDEOIO) - CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP VIDEOIO) - CHECK_MODULE(gstreamer-riff-1.0 HAVE_GSTREAMER_RIFF VIDEOIO) - CHECK_MODULE(gstreamer-pbutils-1.0 HAVE_GSTREAMER_PBUTILS VIDEOIO) - - if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS) + ocv_check_modules(GSTREAMER-1.0 gstreamer-base-1.0 gstreamer-video-1.0 gstreamer-app-1.0 gstreamer-riff-1.0 gstreamer-pbutils-1.0) + if(HAVE_GSTREAMER-1.0) set(HAVE_GSTREAMER TRUE) - set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-1.0_VERSION}) - set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-1.0_VERSION}) - set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-1.0_VERSION}) - set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-1.0_VERSION}) - set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION}) + ocv_append_build_options(VIDEOIO GSTREAMER-1.0) + set(GSTREAMER_BASE_VERSION ${GSTREAMER-1.0_gstreamer-base-1.0_VERSION}) + set(GSTREAMER_VIDEO_VERSION ${GSTREAMER-1.0_gstreamer-video-1.0_VERSION}) + set(GSTREAMER_APP_VERSION ${GSTREAMER-1.0_gstreamer-app-1.0_VERSION}) + set(GSTREAMER_RIFF_VERSION ${GSTREAMER-1.0_gstreamer-riff-1.0_VERSION}) + set(GSTREAMER_PBUTILS_VERSION ${GSTREAMER-1.0_gstreamer-pbutils-1.0_VERSION}) endif() endif(WIN32) -endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10) +endif() # if gstreamer 1.x was not found, or we specified we wanted 0.10, try to find it if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10) - CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER_BASE VIDEOIO) - CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER_VIDEO VIDEOIO) - CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER_APP VIDEOIO) - CHECK_MODULE(gstreamer-riff-0.10 HAVE_GSTREAMER_RIFF VIDEOIO) - CHECK_MODULE(gstreamer-pbutils-0.10 HAVE_GSTREAMER_PBUTILS VIDEOIO) - - if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS) - set(HAVE_GSTREAMER TRUE) - set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-0.10_VERSION}) - set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-0.10_VERSION}) - set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-0.10_VERSION}) - set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION}) - set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION}) + ocv_check_modules(GSTREAMER-0.10 gstreamer-base-0.10 gstreamer-video-0.10 gstreamer-app-0.10 gstreamer-riff-0.10 gstreamer-pbutils-0.10) + if(HAVE_GSTREAMER-0.10) + set(HAVE_GSTREAMER TRUE) + ocv_append_build_options(VIDEOIO GSTREAMER-0.10) + set(GSTREAMER_BASE_VERSION ${GSTREAMER-0.10_gstreamer-base-0.10_VERSION}) + set(GSTREAMER_VIDEO_VERSION ${GSTREAMER-0.10_gstreamer-video-0.10_VERSION}) + set(GSTREAMER_APP_VERSION ${GSTREAMER-0.10_gstreamer-app-0.10_VERSION}) + set(GSTREAMER_RIFF_VERSION ${GSTREAMER-0.10_gstreamer-riff-0.10_VERSION}) + set(GSTREAMER_PBUTILS_VERSION ${GSTREAMER-0.10_gstreamer-pbutils-0.10_VERSION}) endif() -endif(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10) +endif() # --- unicap --- ocv_clear_vars(HAVE_UNICAP) if(WITH_UNICAP) - CHECK_MODULE(libunicap HAVE_UNICAP_ VIDEOIO) - CHECK_MODULE(libucil HAVE_UNICAP_UCIL VIDEOIO) - if(HAVE_UNICAP_ AND HAVE_UNICAP_UCIL) - set(HAVE_UNICAP TRUE) + ocv_check_modules(HAVE_UNICAP libunicap libucil) + if(HAVE_UNICAP) + ocv_append_build_options(VIDEOIO UNICAP) endif() -endif(WITH_UNICAP) +endif() # --- PvApi --- ocv_clear_vars(HAVE_PVAPI) @@ -120,7 +111,7 @@ endif(WITH_GIGEAPI) # --- Aravis SDK --- ocv_clear_vars(HAVE_ARAVIS_API) if(WITH_ARAVIS) - check_module(glib-2.0 HAVE_ARAVIS_GLIB VIDEOIO) + ocv_check_modules(ARAVIS_GLIB glib-2.0) if(HAVE_ARAVIS_GLIB) find_path(ARAVIS_INCLUDE_PATH "arv.h" PATHS /usr/local /var /opt /usr ENV ProgramFiles ENV ProgramW6432 @@ -128,6 +119,7 @@ if(WITH_ARAVIS) DOC "The path to Aravis SDK headers") find_library(ARAVIS_LIBRARIES NAMES "aravis-0.6" "aravis-0.4" ) if(ARAVIS_LIBRARIES AND ARAVIS_INCLUDE_PATH) + ocv_append_build_options(VIDEOIO ARAVIS_GLIB) set(HAVE_ARAVIS_API TRUE) endif() else() @@ -139,6 +131,7 @@ endif(WITH_ARAVIS) ocv_clear_vars(HAVE_DC1394 HAVE_DC1394_2) if(WITH_1394) if(WIN32 AND MINGW) + # TODO remove this, use pkgconfig from MinGW instead find_path(CMU1394_INCLUDE_PATH "/1394common.h" PATH_SUFFIXES include DOC "The path to cmu1394 headers") @@ -153,36 +146,42 @@ if(WITH_1394) endif() endif() if(HAVE_DC1394_2) - ocv_parse_pkg("libdc1394-2" "${DC1394_2_LIB_DIR}/pkgconfig" "") + ocv_parse_pkg(DC1394_2_VERSION "libdc1394-2" "${DC1394_2_LIB_DIR}/pkgconfig") ocv_include_directories(${DC1394_2_INCLUDE_PATH}) set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${DC1394_2_LIB_DIR}/libdc1394.a" "${CMU1394_LIB_DIR}/lib1394camera.a") - endif(HAVE_DC1394_2) - else(WIN32 AND MINGW) - CHECK_MODULE(libdc1394-2 HAVE_DC1394_2 VIDEOIO) - if(NOT HAVE_DC1394_2) - CHECK_MODULE(libdc1394 HAVE_DC1394 VIDEOIO) + endif() + endif() + if(NOT HAVE_DC1394_2) + ocv_check_modules(DC1394_2 libdc1394-2) + if(HAVE_DC1394_2) + ocv_append_build_options(VIDEOIO DC1394_2) + else() + ocv_check_modules(DC1394 libdc1394) + if(HAVE_DC1394) + ocv_append_build_options(VIDEOIO DC1394) + endif() endif() - endif(WIN32 AND MINGW) -endif(WITH_1394) + endif() +endif() # --- xine --- ocv_clear_vars(HAVE_XINE) if(WITH_XINE) - CHECK_MODULE(libxine HAVE_XINE VIDEOIO) + ocv_check_modules(XINE libxine) + if(HAVE_XINE) + ocv_append_build_options(VIDEOIO XINE) + endif() endif(WITH_XINE) # --- V4L --- ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2 HAVE_VIDEOIO) if(WITH_V4L) if(WITH_LIBV4L) - CHECK_MODULE(libv4l1 HAVE_LIBV4L1 VIDEOIO) - CHECK_MODULE(libv4l2 HAVE_LIBV4L2 VIDEOIO) - if(HAVE_LIBV4L1 AND HAVE_LIBV4L2) - set(HAVE_LIBV4L YES) - else() - set(HAVE_LIBV4L NO) + ocv_check_modules(LIBV4L libv4l1 libv4l2) + if(HAVE_LIBV4L) + ocv_append_build_options(VIDEOIO LIBV4L) endif() endif() CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L) @@ -323,8 +322,11 @@ endif() # --- gPhoto2 --- ocv_clear_vars(HAVE_GPHOTO2) if(WITH_GPHOTO2) - CHECK_MODULE(libgphoto2 HAVE_GPHOTO2 VIDEOIO) -endif(WITH_GPHOTO2) + ocv_check_modules(GPHOTO2 libgphoto2) + if(HAVE_GPHOTO2) + ocv_append_build_options(VIDEOIO GPHOTO2) + endif() +endif() # --- VA & VA_INTEL --- if(WITH_VA_INTEL) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 5772ca8d76..6c5b44b009 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -701,7 +701,7 @@ endfunction() # Usage: ocv_append_build_options(HIGHGUI FFMPEG) macro(ocv_append_build_options var_prefix pkg_prefix) - foreach(suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS) + foreach(suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS LINK_LIBRARIES) if(${pkg_prefix}_${suffix}) list(APPEND ${var_prefix}_${suffix} ${${pkg_prefix}_${suffix}}) list(REMOVE_DUPLICATES ${var_prefix}_${suffix}) @@ -739,7 +739,9 @@ macro(ocv_check_modules define) endif() unset(${define}_${__modname}_FOUND) endforeach() - pkg_check_modules(${define} ${ARGN}) + if(COMMAND pkg_check_modules) + pkg_check_modules(${define} ${ARGN}) + endif() if(${define}_FOUND) set(HAVE_${define} 1) endif() @@ -753,29 +755,47 @@ macro(ocv_check_modules define) set(${define}_${__modname}_FOUND 1) endif() endforeach() -endmacro() - - -# Macro that checks if module has been installed. -# After it adds module to build and define -# constants passed as second arg -macro(CHECK_MODULE module_name define cv_module) - set(${define} 0) - if(PKG_CONFIG_FOUND) - set(ALIAS ALIASOF_${module_name}) - set(ALIAS_FOUND ${ALIAS}_FOUND) - set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS) - set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS) - set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES) - - PKG_CHECK_MODULES(${ALIAS} ${module_name}) - if(${ALIAS_FOUND}) - set(${define} 1) - ocv_append_build_options(${cv_module} ${ALIAS}) + if(${define}_FOUND AND ${define}_LIBRARIES) + if(${define}_LINK_LIBRARIES_XXXXX) # CMake 3.12+: https://gitlab.kitware.com/cmake/cmake/merge_requests/2068 + set(${define}_LIBRARIES "${${define}_LINK_LIBRARIES}" CACHE INTERNAL "") + else() + unset(_libs) # absolute paths + unset(_libs_paths) # -L args + foreach(flag ${${define}_LDFLAGS}) + if(flag MATCHES "^-L(.*)") + list(APPEND _libs_paths ${CMAKE_MATCH_1}) + elseif(IS_ABSOLUTE "${flag}") + list(APPEND _libs "${flag}") + elseif(flag MATCHES "^-l(.*)") + set(_lib "${CMAKE_MATCH_1}") + if(_libs_paths) + find_library(pkgcfg_lib_${define}_${_lib} NAMES ${_lib} + HINTS ${_libs_paths} NO_DEFAULT_PATH) + endif() + find_library(pkgcfg_lib_${define}_${_lib} NAMES ${_lib}) + mark_as_advanced(pkgcfg_lib_${define}_${_lib}) + if(pkgcfg_lib_${define}_${_lib}) + list(APPEND _libs "${pkgcfg_lib_${define}_${_lib}}") + else() + message(WARNING "ocv_check_modules(${define}): can't find library '${_lib}'. Specify 'pkgcfg_lib_${define}_${_lib}' manualy") + list(APPEND _libs "${_lib}") + endif() + else() + # -pthread + #message(WARNING "ocv_check_modules(${define}): unknown LDFLAG '${flag}'") + endif() + endforeach() + set(${define}_LINK_LIBRARIES "${_libs}") + set(${define}_LIBRARIES "${_libs}" CACHE INTERNAL "") + unset(_lib) + unset(_libs) + unset(_libs_paths) endif() endif() endmacro() + + if(NOT DEFINED CMAKE_ARGC) # Guard CMake standalone invocations # Use this option carefully, CMake's install() will install symlinks instead of real files @@ -1290,11 +1310,12 @@ macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME) endif() endmacro() +# TODO remove this # read single version info from the pkg file -macro(ocv_parse_pkg LIBNAME PKG_PATH SCOPE) +macro(ocv_parse_pkg ver_varname LIBNAME PKG_PATH) if(EXISTS "${PKG_PATH}/${LIBNAME}.pc") file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1) - STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ALIASOF_${LIBNAME}_VERSION "${line_to_parse}" ) + STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ${ver_varname} "${line_to_parse}" ) endif() endmacro() diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index af54d9c3a0..e02c55deb8 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -128,8 +128,8 @@ elseif(HAVE_COCOA) list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa") endif() -if(UNIX) - #these variables are set by CHECK_MODULE macro +if(TRUE) + # these variables are set by 'ocv_append_build_options(HIGHGUI ...)' foreach(P ${HIGHGUI_INCLUDE_DIRS}) ocv_include_directories(${P}) endforeach() diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt index f83a12da73..50354769e6 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt @@ -111,8 +111,8 @@ if(APPLE_FRAMEWORK) list(APPEND IMGCODECS_LIBRARIES "-framework UIKit") endif() -if(UNIX) - #these variables are set by CHECK_MODULE macro +if(TRUE) + # these variables are set by 'ocv_append_build_options(IMGCODECS ...)' foreach(P ${IMGCODECS_INCLUDE_DIRS}) ocv_include_directories(${P}) endforeach() diff --git a/modules/videoio/CMakeLists.txt b/modules/videoio/CMakeLists.txt index 08c3967706..d3f24b65cc 100644 --- a/modules/videoio/CMakeLists.txt +++ b/modules/videoio/CMakeLists.txt @@ -233,8 +233,8 @@ if(IOS) list(APPEND VIDEOIO_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit") endif() -if(UNIX) - #these variables are set by CHECK_MODULE macro +if(TRUE) + # these variables are set by 'ocv_append_build_options(VIDEOIO ...)' foreach(P ${VIDEOIO_INCLUDE_DIRS}) ocv_include_directories(${P}) endforeach()