diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake index c9fe29ced..16dbb06a9 100644 --- a/cmake/OpenCVPCHSupport.cmake +++ b/cmake/OpenCVPCHSupport.cmake @@ -328,7 +328,7 @@ ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) macro(ocv_add_precompiled_header_to_target the_target pch_header) if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}") if(CMAKE_GENERATOR MATCHES Visual) - set(${the_target}_pch "${pch_header}") + string(REGEX REPLACE "hpp$" "cpp" ${the_target}_pch "${pch_header}") add_native_precompiled_header(${the_target} ${pch_header}) unset(${the_target}_pch) elseif(CMAKE_GENERATOR MATCHES Xcode)