Repository: opencv
Issue: CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file)
Labels: bug,category: build/install,incomplete,needs reproducer

### System Information

- OpenCV version: 4.7.0
- Operating System / Platform: Ubuntu 22.04
- Compiler & compiler version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
- Python version: Python 3.10.6

### Detailed description

Just trying to build OpenCV git of today: June 18, 2023. (4.7.0), but failed to configure:

```console
 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)

......

CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2098 (cuda_compile_base)
   cmake/OpenCVDetectCUDA.cmake:451 (CUDA_COMPILE)
   cmake/OpenCVUtils.cmake:1556 (ocv_cuda_compile)
   cmake/OpenCVModule.cmake:989 (ocv_add_library)
   cmake/OpenCVModule.cmake:905 (_ocv_create_module)
   modules/world/CMakeLists.txt:60 (ocv_create_module)

 CMake Error at /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:1767 (file):
   Error evaluating generator expression:

     $<TARGET_PROPERTY:QT_TESTCASE_BUILDDIR>

   $<TARGET_PROPERTY:prop> may only be used with binary targets.  It may not
   be used with add_custom_command or add_custom_target.  Specify the target
   to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
   instead.
 Call Stack (most recent call first):
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:2085 (CUDA_WRAP_SRCS)
   /usr/local/share/cmake-3.26/Modules/FindCUDA.cmake:20
```



### Steps to reproduce

Just trying the cmake configuration.

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)