https://github.com/opencv/opencv/pull/26234 From 6a4be763b2db5f26684204ddc7d06c02325c3917 Mon Sep 17 00:00:00 2001 From: Zach Lowry Date: Tue, 1 Oct 2024 14:16:54 -0500 Subject: [PATCH 1/2] move the gcc6 compatibility check to occur on a per-directory basis, rather than exclude all include paths when the list of paths contains /usr/include --- cmake/OpenCVUtils.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 94f87d9a1200..bb20a22f0606 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -353,23 +353,23 @@ function(ocv_target_include_directories target) #ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})") _ocv_fix_target(target) set(__params "") - if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND - ";${ARGN};" MATCHES "/usr/include;") - return() # workaround for GCC 6.x bug - endif() - set(__params "") set(__system_params "") set(__var_name __params) foreach(dir ${ARGN}) if("${dir}" STREQUAL "SYSTEM") set(__var_name __system_params) else() - get_filename_component(__abs_dir "${dir}" ABSOLUTE) - ocv_is_opencv_directory(__is_opencv_dir "${dir}") - if(__is_opencv_dir) - list(APPEND ${__var_name} "${__abs_dir}") + if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND + "${dir}" MATCHES "/usr/include$") + # workaround for GCC 6.x bug else() - list(APPEND ${__var_name} "${dir}") + get_filename_component(__abs_dir "${dir}" ABSOLUTE) + ocv_is_opencv_directory(__is_opencv_dir "${dir}") + if(__is_opencv_dir) + list(APPEND ${__var_name} "${__abs_dir}") + else() + list(APPEND ${__var_name} "${dir}") + endif() endif() endif() endforeach() From fc01b270ee657e7afc2657b7a9e15766aa36faf0 Mon Sep 17 00:00:00 2001 From: Zach Lowry Date: Wed, 2 Oct 2024 13:28:57 -0500 Subject: [PATCH 2/2] use `dir MATCHES ...` without variable unpacking --- cmake/OpenCVUtils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index bb20a22f0606..5886f4f3cb33 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -360,7 +360,7 @@ function(ocv_target_include_directories target) set(__var_name __system_params) else() if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND - "${dir}" MATCHES "/usr/include$") + dir MATCHES "/usr/include$") # workaround for GCC 6.x bug else() get_filename_component(__abs_dir "${dir}" ABSOLUTE)