blob: 5d0bf97cab63d990336ab519c372b01ea01b5512 [file] [log] [blame]
Patrick Williamsddad1a12017-02-23 20:36:32 -06001diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
2index 28ccc1c6be4f..b0e1cbf77287 100644
3--- a/cmake/OpenCVPCHSupport.cmake
4+++ b/cmake/OpenCVPCHSupport.cmake
5@@ -19,7 +19,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
6 ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
7 OUTPUT_VARIABLE gcc_compiler_version)
8 #MESSAGE("GCC Version: ${gcc_compiler_version}")
9- IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
10+ IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
11 SET(PCHSupport_FOUND TRUE)
12 ENDIF()
13
14diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
15index 3a23cd73633d..1fea1578b1d9 100644
16--- a/cmake/OpenCVUtils.cmake
17+++ b/cmake/OpenCVUtils.cmake
18@@ -76,7 +76,11 @@ function(ocv_include_directories)
19 if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
20 list(APPEND __add_before "${dir}")
21 else()
22- include_directories(AFTER SYSTEM "${dir}")
23+ if (gcc_compiler_version VERSION_LESS "6.0.0")
24+ include_directories(AFTER SYSTEM "${dir}")
25+ else()
26+ include_directories(AFTER "${dir}")
27+ endif()
28 endif()
29 endforeach()
30 include_directories(BEFORE ${__add_before})