diff --git a/modules/cudev/test/CMakeLists.txt b/modules/cudev/test/CMakeLists.txt index d8768ab6c56..666b47c4165 100644 --- a/modules/cudev/test/CMakeLists.txt +++ b/modules/cudev/test/CMakeLists.txt @@ -19,20 +19,24 @@ if(OCV_DEPENDENCIES_FOUND) if(NOT ENABLE_CUDA_FIRST_CLASS_LANGUAGE) ocv_check_windows_crt_linkage() set(target_libs ${target_libs} ${CUDA_LIBRARIES}) + set(test_cudev_cuda_options "") if(CUDA_VERSION VERSION_LESS "11.0") # Windows version does not support --std option if(UNIX OR APPLE) - ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++11") + list(APPEND test_cudev_cuda_options "-std=c++11") endif() else() if(CUDA_VERSION VERSION_LESS "12.8") - ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++14") + list(APPEND test_cudev_cuda_options "-std=c++14") else() - ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++17") + list(APPEND test_cudev_cuda_options "-std=c++17") + if(WIN32) + list(APPEND test_cudev_cuda_options "-Xcompiler=/Zc:preprocessor") + endif() endif() ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations) endif() - CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} OPTIONS ${OPENCV_CUDA_OPTIONS_opencv_test_cudev}) + CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module}_SOURCES} OPTIONS ${test_cudev_cuda_options}) else() ocv_add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES}) endif()