0
0
mirror of https://github.com/opencv/opencv.git synced 2026-01-18 17:21:42 +01:00

Merge pull request #27107 from Kumataro:fix27105

build: Check supported C++ standard features and user setting #27107

Close #27105 

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [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
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Kumataro
2025-03-31 17:31:14 +09:00
committed by GitHub
parent 1f468dd586
commit 09c71aed14
3 changed files with 33 additions and 26 deletions

View File

@@ -64,6 +64,21 @@ Only 0- and 1-level deep module locations are supported, following command will
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib ../opencv
```
## Build with C++ Standard setting {#tutorial_config_reference_general_cxx_standard}
`CMAKE_CXX_STANDARD` option can be used to set C++ standard settings for OpenCV building.
```.sh
cmake -DCMAKE_CXX_STANDARD=17 ../opencv
cmake --build .
```
- C++11 is default/required/recommended for OpenCV 4.x. C++17 is default/required/recomended for OpenCV 5.x.
- If your compiler does not support required C++ Standard features, OpenCV configuration should be fail.
- If you set older C++ Standard than required, OpenCV configuration should be fail.
For workaround, `OPENCV_SKIP_CMAKE_CXX_STANDARD` option can be used to skip `CMAKE_CXX_STANDARD` version check.
- If you set newer C++ Standard than recomended, numerous warnings may appear or OpenCV build may fail.
## Debug build {#tutorial_config_reference_general_debug}