From 08f7f13dfab327967f61a6a4242ed233dfeaad32 Mon Sep 17 00:00:00 2001 From: Zach Lowry Date: Fri, 11 Oct 2024 09:00:59 -0500 Subject: [PATCH] Merge pull request #26234 from zachlowry:apply-gcc6-fix-on-each-directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the gcc6 compatibility check to occur on a per-directory basis, … #26234 Proposed fix for #26233 https://github.com/opencv/opencv/issues/26233 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- cmake/OpenCVUtils.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 94f87d9a12..5886f4f3cb 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()