mirror of
https://github.com/opencv/opencv.git
synced 2026-09-25 04:09:57 +03:00
1f8257adadd01a6bbaf39e72be72cdb36cf32303
Fix Clp library detection for vcpkg on Windows #28423 ## Problem Building OpenCV with `WITH_CLP=ON` on Windows (vcpkg) fails: LINK : fatal error LNK1181: cannot open input file 'libClp.lib' vcpkg generates `Clp.lib` and `CoinUtils.lib`, but OpenCV expected `libClp.lib`/`libCoinUtils.lib`. ## Solution Modernize CLP detection with a robust, platform-aware approach: 1. **CMake `find_package(Clp CONFIG)`**: detects vcpkg and uses imported targets (`Coin::Clp`, `Coin::CoinUtils`) 2. **Fallback**: pkg-config on Unix/Linux 3. **Skip** Android/iOS ## Benefits ✅ Fixes Windows build with vcpkg ✅ Uses modern CMake targets ✅ Backward compatible with Unix/Linux ✅ Safe for CI and mobile builds ✅ Graceful fallback if CLP unavailable ## Testing - **Windows 11 + vcpkg**: build succeeds - **No CLP installed**: configure/build succeeds - **Linux/Unix**: existing workflows unaffected - **Android/iOS**: properly skipped ## Changes - Update `cmake/OpenCVFindLibsPerf.cmake` - Replace hardcoded library names with CMake targets - Add mobile platform guards - Preserve backward compatibility Fixes #26592 --- ### Pull Request Readiness Checklist - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch (`4.x`) - [x] There is a reference to the original bug report and related work (#26592) - [x] The feature is well documented and sample code can be built with the project CMake - [x] No additional tests required - this is a build system fix that maintains existing functionality
OpenCV: Open Source Computer Vision Library
Resources
- Homepage: https://opencv.org
- Courses: https://opencv.org/courses
- Docs: https://docs.opencv.org/4.x/
- Q&A forum: https://forum.opencv.org
- previous forum (read only): http://answers.opencv.org
- Issue tracking: https://github.com/opencv/opencv/issues
- Additional OpenCV functionality: https://github.com/opencv/opencv_contrib
- Donate to OpenCV: https://opencv.org/support/
Contributing
Please read the contribution guidelines before starting work on a pull request.
Summary of the guidelines:
- One pull request per issue;
- Choose the right base branch;
- Include tests and documentation;
- Clean up "oops" commits before submitting;
- Follow the coding style guide.
Additional Resources
- Submit your OpenCV-based project for inclusion in Community Friday on opencv.org
- Subscribe to the OpenCV YouTube Channel featuring OpenCV Live, an hour-long streaming show
- Follow OpenCV on LinkedIn for daily posts showing the state-of-the-art in computer vision & AI
- Apply to be an OpenCV Volunteer to help organize events and online campaigns as well as amplify them
- Follow OpenCV on Mastodon in the Fediverse
- Follow OpenCV on Twitter
- OpenCV.ai: Computer Vision and AI development services from the OpenCV team.
Languages
C++
86%
Python
4.1%
C
2.9%
CMake
2.2%
Java
1.6%
Other
3.1%