Skip to content

Commit 572c861

Browse files
ChristofKaufmannalalek
authored andcommitted
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 8736ece commit 572c861

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
@@ -69,6 +69,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
6969
FOREACH(item ${DIRINC})
7070
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
7171
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
72+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
73+
item MATCHES "/usr/include$")
74+
# workaround for GCC 6.x bug
7275
else()
7376
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
7477
endif()
@@ -78,6 +81,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
7881
FOREACH(item ${DIRINC})
7982
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
8083
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
84+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
85+
item MATCHES "/usr/include$")
86+
# workaround for GCC 6.x bug
8187
else()
8288
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
8389
endif()

0 commit comments

Comments
 (0)