CMake fails with generator Ninja Multi-Config when including WITH_CUDA
envgap__opencv__opencv_contrib-3143
01 / FAILURE SIGNATURE
As reported upstream
Legacy variable expansion in source file
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
0bcbc73bca0b7b2ff6d6572c730b34c68553c429- Manifest
modules/cudaarithm/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
opencv/opencv_contrib #3143 · read the original issue
##### System information (version)
- OpenCV => 4.5.5
- Operating System / Platform => Windows 10 64 Bit, Ubuntu 20.04 LTS
- Compiler => Visual Studio 2019, gcc version 9.3.0
##### Detailed description
On windows and linux passing the generator Ninja Multi-Config works until WITH_CUDA is selected, then CMake configuration fails with lots of errors similar to
```
CMake Error at cmake/OpenCVUtils.cmake:1547 (add_library):
Legacy variable expansion in source file
"D:/build/opencv/modules/superres/CMakeFiles/cuda_compile_1.dir/src/cuda/${CONFIGURATION}/cuda_compile_1_generated_btv_l1_gpu.cu.obj"
expanded to
"D:/build/opencv/modules/superres/CMakeFiles/cuda_compile_1.dir/src/cuda//cuda_compile_1_generated_btv_l1_gpu.cu.obj"
in target "opencv_superres". This behavior will be removed in a future
version of CMake.
Call Stack (most recent call first):
cmake/OpenCVModule.cmake:966 (ocv_add_library)
cmake/OpenCVModule.cmake:882 (_ocv_create_module)
cmake/OpenCVModule.cmake:1108 (ocv_create_module)
D:/repos/opencv/contrib/modules/superres/CMakeLists.txt:9 (ocv_define_module)
```
##### Steps to reproduce
```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
"C:\Program Files\CMake\bin\cmake.exe" . -G"Ninja Multi-Config" -DOPENCV_EXTRA_MODULES_PATH="../contrib/modules" -B"D:/build/opencv" -DWITH_CUDA=ON
```
##### Issue submission checklist
- [x] I report the issue, it's not a question
<!--
OpenCV team works with answers.opencv.org, Stack Overflow and other communities
to discuss problems. Tickets with question without real issue statement will be
closed.
-->
- [x] I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution
<!--
Places to check:
* OpenCV documentation: https://docs.opencv.org
* FAQ page: https://github.com/opencv/opencv/wiki/FAQ
* OpenCV forum: https://answers.opencv.org
* OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
* OpenCV Contrib issue tracker: https://github.com/opencv/opencv_contrib/issues?q=is%3Aissue
* Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
-->
- [x] I updated to latest OpenCV version and the issue is still there
<!--
master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
OpenCV team supports only latest release for each branch.
The ticket is closed, if the problem is not reproduced with modern version.
-->
- [x] There is reproducer code and related data files: videos, images, onnx, etc
<!--
The best reproducer -- test case for OpenCV that we can add to the library.
Recommendations for media files and binary files:
* Try to reproduce the issue with images and videos in opencv_extra repository
to reduce attachment size
* Use PNG for images, if you report some CV related bug, but not image reader
issue
* Attach the image as archive to the ticket, if you report some reader issue.
Image hosting services compress images and it breaks the repro code.
* Provide ONNX file for some public model or ONNX file with with random weights,
if you report ONNX parsing or handling issue. Architecture details diagram
from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
-->
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]