From 0f6503d9a9af09cfe78774357345ad0819aaef5b Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Sun, 24 Jul 2011 21:08:36 +0000 Subject: [PATCH] Fixed precompiled headeds for non-windows systems. --- OpenCVPCHSupport.cmake | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/OpenCVPCHSupport.cmake b/OpenCVPCHSupport.cmake index d0acecceb..bd47ec8b6 100644 --- a/OpenCVPCHSupport.cmake +++ b/OpenCVPCHSupport.cmake @@ -68,15 +68,27 @@ ENDMACRO(_PCH_GET_COMPILE_FLAGS) MACRO(_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp) SET(${_dephelp} ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch_dephelp.cxx) - ADD_CUSTOM_COMMAND( - OUTPUT "${${_dephelp}}" - COMMAND ${CMAKE_COMMAND} -E echo "#include \\\"${_include_file}\\\"" > "${${_dephelp}}" - COMMAND ${CMAKE_COMMAND} -E echo "int testfunction()" >> "${${_dephelp}}" - COMMAND ${CMAKE_COMMAND} -E echo "{" >> "${${_dephelp}}" - COMMAND ${CMAKE_COMMAND} -E echo " return 0;" >> "${${_dephelp}}" - COMMAND ${CMAKE_COMMAND} -E echo "}" >> "${${_dephelp}}" - DEPENDS "${_include_file}" - ) + IF(CMAKE_HOST_WIN32) + ADD_CUSTOM_COMMAND( + OUTPUT "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "#include \\\"${_include_file}\\\"" > "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "int testfunction()" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "{" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo " return 0;" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "}" >> "${${_dephelp}}" + DEPENDS "${_include_file}" + ) + else() + ADD_CUSTOM_COMMAND( + OUTPUT "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "#include \\\"${_include_file}\\\"" > "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "int testfunction\\(\\)" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "{" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo " return 0;" >> "${${_dephelp}}" + COMMAND ${CMAKE_COMMAND} -E echo "}" >> "${${_dephelp}}" + DEPENDS "${_include_file}" + ) + endif() ENDMACRO(_PCH_WRITE_PCHDEP_CXX )