Skip to content

Commit 583e3a6

Browse files
cmake: Avoid adding default path as system directory for GCC 6.x
This is a completion for PR opencv#7390 and fixes opencv#6517 and opencv#815.
1 parent e4377e7 commit 583e3a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/OpenCVPCHSupport.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
6565
ocv_is_opencv_directory(__result ${item})
6666
if(__result)
6767
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
68+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
69+
item MATCHES "/usr/include$")
70+
# workaround for GCC 6.x bug
6871
else()
6972
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
7073
endif()
@@ -75,6 +78,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
7578
ocv_is_opencv_directory(__result ${item})
7679
if(__result)
7780
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
81+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
82+
item MATCHES "/usr/include$")
83+
# workaround for GCC 6.x bug
7884
else()
7985
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
8086
endif()

0 commit comments

Comments
 (0)