diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake index 0e41130b0f..6a2f6ee655 100644 --- a/cmake/OpenCVPCHSupport.cmake +++ b/cmake/OpenCVPCHSupport.cmake @@ -56,6 +56,15 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) endforeach() endif() + GET_TARGET_PROPERTY(_cxx_standard ${_PCH_current_target} CXX_STANDARD) + if (_cxx_standard) + GET_TARGET_PROPERTY(_cxx_extensions ${_PCH_current_target} CXX_EXTENSIONS) + if (_cxx_extensions) + LIST(APPEND ${_out_compile_flags} "${CMAKE_CXX${_cxx_standard}_EXTENSION_COMPILE_OPTION}") + else() + LIST(APPEND ${_out_compile_flags} "${CMAKE_CXX${_cxx_standard}_STANDARD_COMPILE_OPTION}") + endif() + endif() ELSE() ## TODO ... ? or does it work out of the box ENDIF()