Merge pull request #26234 from zachlowry:apply-gcc6-fix-on-each-directory

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
pull/21407/merge
Zach Lowry 1 month ago committed by GitHub
parent 0f234209da
commit 08f7f13dfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      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()

Loading…
Cancel
Save