Repository: opencv
Issue: OpenCVFindLibsPerf.cmake/with_clp error if you build Clp via vC
Labels: bug,category: build/install,platform: win32

### System Information

OpenCV version: 4.10.0 (and others)
Operating System / Platform: Windows 11
Compiler & compiler version: MSVC (latest)

### Detailed description

I got this output while building fat java on Windows 11 with "WITH_CLP":

```
[2037/2067] C:\Windows\system32\cmd.exe /C "cd . && C:\CMake\cmake-3.31.2\bin\cmake.exe -E vs_link_dll --msvc-ver=1942 --intdir=modules\java\jni\CMakeFiles\opencv_java.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests  -- C:\VStudio\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\link.exe  @CMakeFiles\opencv_java.rsp  /out:bin\opencv_java4100.dll /implib:lib\opencv_java4100.lib /pdb:bin\opencv_java4100.pdb /dll /version:0.0 /machine:x64  /INCREMENTAL:NO && C:\Windows\system32\cmd.exe /C "cd /D C:\opencv3\build\modules\java\jni && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/opencv3/build/bin/opencv_java4100.dll -installedDir c:/opencv2/vcpkg_installed/x64-windows/bin -OutVariable out""
FAILED: bin/opencv_java4100.dll lib/opencv_java4100.lib
C:\Windows\system32\cmd.exe /C "cd . && C:\CMake\cmake-3.31.2\bin\cmake.exe -E vs_link_dll --msvc-ver=1942 --intdir=modules\java\jni\CMakeFiles\opencv_java.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests  -- C:\VStudio\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\link.exe  @CMakeFiles\opencv_java.rsp  /out:bin\opencv_java4100.dll /implib:lib\opencv_java4100.lib /pdb:bin\opencv_java4100.pdb /dll /version:0.0 /machine:x64  /INCREMENTAL:NO && C:\Windows\system32\cmd.exe /C "cd /D C:\opencv3\build\modules\java\jni && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/opencv3/build/bin/opencv_java4100.dll -installedDir c:/opencv2/vcpkg_installed/x64-windows/bin -OutVariable out""
LINK: command "C:\VStudio\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\link.exe @CMakeFiles\opencv_java.rsp /out:bin\opencv_java4100.dll /implib:lib\opencv_java4100.lib /pdb:bin\opencv_java4100.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /MANIFEST:EMBED,ID=2" failed (exit code 1181) with the following output:
Microsoft (R) Incremental Linker Version 14.42.34435.0
Copyright (C) Microsoft Corporation.  All rights reserved.

modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\Mat.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\converters.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\jni_part.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\listconverters.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\opencv_java.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\generator\src\cpp\utils.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\__\core\misc\java\src\cpp\core_manual.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\__\dnn\misc\java\src\cpp\dnn_converters.cpp.obj
modules\java\jni\CMakeFiles\opencv_java.dir\__\__\features2d\misc\java\src\cpp\features2d_converters.cpp.obj -LIBPATH:C:\PROGRA~1\NVIDIA~2\CUDA\v12.6\lib\x64 -LIBPATH:C:\opencv2\vcpkg_installed\x64-windows\lib lib\opencv_cudev4100.lib lib\opencv_core4100.lib lib\opencv_cudaarithm4100.lib lib\opencv_flann4100.lib lib\opencv_imgproc4100.lib lib\opencv_ml4100.lib lib\opencv_phase_unwrapping4100.lib lib\opencv_plot4100.lib lib\opencv_quality4100.lib lib\opencv_viz4100.lib lib\opencv_cudafilters4100.lib lib\opencv_cudaimgproc4100.lib lib\opencv_dnn4100.lib lib\opencv_dnn_superres4100.lib lib\opencv_features2d4100.lib lib\opencv_img_hash4100.lib lib\opencv_imgcodecs4100.lib lib\opencv_photo4100.lib lib\opencv_text4100.lib lib\opencv_videoio4100.lib lib\opencv_xphoto4100.lib lib\opencv_calib3d4100.lib lib\opencv_datasets4100.lib lib\opencv_highgui4100.lib lib\opencv_objdetect4100.lib lib\opencv_shape4100.lib lib\opencv_structured_light4100.lib lib\opencv_video4100.lib lib\opencv_xfeatures2d4100.lib lib\opencv_ximgproc4100.lib lib\opencv_aruco4100.lib lib\opencv_bgsegm4100.lib lib\opencv_bioinspired4100.lib lib\opencv_face4100.lib lib\opencv_tracking4100.lib 3rdparty\lib\ippiw.lib 3rdparty\ippicv\ippicv_win\icv\lib\intel64\ippicvmt.lib cudart.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib "-LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/lib/x64" libClp.lib libCoinUtils.lib lib\opencv_quality4100.lib lib\opencv_phase_unwrapping4100.lib lib\opencv_viz4100.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkFiltersTexture-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOExport-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingContext2D-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingFreeType-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\freetype.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingVtkJS-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingSceneGraph-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\jsoncpp.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOGeometry-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOPLY-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkInteractionStyle-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkFiltersExtraction-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOXML-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOXMLParser-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOLegacy-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOCore-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingLOD-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingOpenGL2-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkIOImage-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingHyperTreeGrid-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkImagingCore-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingUI-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkRenderingCore-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkFiltersSources-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkFiltersGeneral-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkFiltersCore-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonExecutionModel-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\glew32.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonDataModel-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonMisc-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonTransforms-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonMath-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkkissfft-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtkCommonCore-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtktoken-9.3.lib C:\opencv2\vcpkg_installed\x64-windows\lib\vtksys-9.3.lib dbghelp.lib psapi.lib lib\opencv_shape4100.lib lib\opencv_photo4100.lib lib\opencv_cudaimgproc4100.lib lib\opencv_cudafilters4100.lib lib\opencv_cudaarithm4100.lib lib\opencv_objdetect4100.lib lib\opencv_plot4100.lib lib\opencv_datasets4100.lib lib\opencv_text4100.lib lib\opencv_ml4100.lib C:\dev\Tesseract\lib\tesseract55.lib C:\dev\Tesseract\debug\lib\tesseract55d.lib C:\dev\Tesseract\lib\leptonica-1.84.1.lib C:\dev\Tesseract\debug\lib\leptonica-1.84.1d.lib lib\opencv_highgui4100.lib lib\opencv_videoio4100.lib lib\opencv_imgcodecs4100.lib 3rdparty\lib\libjpeg-turbo.lib 3rdparty\lib\libwebp.lib 3rdparty\lib\libpng.lib 3rdparty\lib\libtiff.lib 3rdparty\lib\libopenjp2.lib 3rdparty\lib\IlmImf.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstreamer-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstbase-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstapp-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstriff-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstvideo-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstaudio-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gstpbutils-1.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\glib-2.0.lib C:\opencv2\vcpkg_installed\x64-windows\lib\gobject-2.0.lib comctl32.lib gdi32.lib ole32.lib setupapi.lib ws2_32.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6Test.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6Concurrent.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6OpenGLWidgets.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6Widgets.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6OpenGL.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6Gui.lib C:\Dev\QT\vcpkg_installed\x64-windows\lib\Qt6Core.lib mpr.lib userenv.lib d3d11.lib dxgi.lib dxguid.lib d3d12.lib lib\opencv_video4100.lib lib\opencv_dnn4100.lib 3rdparty\lib\libprotobuf.lib C:\OpenVINO\runtime\lib\intel64\Release\openvino.lib lib\opencv_calib3d4100.lib lib\opencv_features2d4100.lib lib\opencv_flann4100.lib lib\opencv_imgproc4100.lib lib\opencv_core4100.lib lib\opencv_cudev4100.lib C:\OneApi\2025.0\lib\tbb12.lib 3rdparty\lib\zlib.lib opengl32.lib glu32.lib 3rdparty\lib\ittnotify.lib C:\opencv2\vcpkg_installed\x64-windows\lib\lapack.lib C:\opencv2\vcpkg_installed\x64-windows\lib\openblas.lib 3rdparty\lib\ippiw.lib 3rdparty\ippicv\ippicv_win\icv\lib\intel64\ippicvmt.lib cudart.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib "-LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/lib/x64" libClp.lib libCoinUtils.lib C:\Dev\Halide\lib\Release\Halide.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
LINK : fatal error LNK1181: cannot open input file 'libClp.lib'
```
this block in cmake/OpenCVFindLibsPerf.cmake at line 151:

```
      if(UNIX)
        set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils m)
      else()
        if(MINGW)
            set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils)
        else()
            set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libClp libCoinUtils)
        endif()
      endif()
```

is incorrect if you install Clp with VCPKG on Windows because they name the libraries without the 'lib' prefix.

I know this is incorrect if you don't use VCPKG, but this worked as a workaround for me:
```
      if(UNIX)
        set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils m)
      else()
        set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libClp libCoinUtils)
      endif()
```


### Steps to reproduce

on a windows system run:
`vcpkg install coin-or-clp`


then build opencv WITH_CLP using the vcpkg toolchain.

### 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)