From d83d2d4c2fe6aa8a910faa7f705b304ee9048e2c Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.alekhin@itseez.com>
Date: Mon, 3 Aug 2015 14:36:58 +0300
Subject: [PATCH] viz: fix precompiled headers definitions

---
 cmake/OpenCVPCHSupport.cmake | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
index e5fb90e6ff..1c03f36f9c 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -48,10 +48,16 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
             LIST(APPEND ${_out_compile_flags} "-fPIC")
         ENDIF()
 
+        GET_PROPERTY(_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
+        if(_definitions)
+          foreach(_def ${_definitions})
+            LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
+          endforeach()
+        endif()
         GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS)
         if(_target_definitions)
           foreach(_def ${_target_definitions})
-            LIST(APPEND ${_out_compile_flags} "-D${_def}")
+            LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
           endforeach()
         endif()
 
-- 
2.18.0