From a3f74aaaafcccc7272c0cbd228337830f7973e98 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 30 Sep 2016 23:37:43 +0300 Subject: [PATCH] cmake: repair GCC PCH --- cmake/OpenCVPCHSupport.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake index a2df014a2e..aafda61ab2 100644 --- a/cmake/OpenCVPCHSupport.cmake +++ b/cmake/OpenCVPCHSupport.cmake @@ -291,6 +291,14 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input) ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn}) + + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + if (oldProps MATCHES NOTFOUND) + SET(oldProps "") + endif() + SET(newProperties "${oldProps} -include \"${CMAKE_CURRENT_BINARY_DIR}/${_name}\"") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") + ENDMACRO(ADD_PRECOMPILED_HEADER)