Wentsing Nee 44fb94f7a1
[opencv4] Fix build failure when dnn feature is not enabled (#38594)
Given the following manifest (when `dnn` feature is not included):

```json
"dependencies": [
  {
    "name": "opencv4",
    "version>=": "4.8.0#18",
    "default-features": false,
    "features": [
      "png"
    ]
  }
]
```

it failed and here is what
`vcpkg/buildtrees/opencv4/config-x64-linux-out.log` said:

```
...
CMake Error at /home/peter/open-source/git/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package):
  Could not find a package configuration file provided by "flatbuffers" with
  any of the following names:

    flatbuffersConfig.cmake
    flatbuffers-config.cmake

  Add the installation prefix of "flatbuffers" to CMAKE_PREFIX_PATH or set
  "flatbuffers_DIR" to a directory containing one of the above files.  If
  "flatbuffers" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:759 (find_package)
...
```

This problem is introduced by [commit
6d2c9714](6d2c971458)
contributed by @jimwang118

In the patch `vcpkg/ports/opencv4/0023-fix-no-flatbuffers.patch`, Jim
disabled the procedure of `Flatbuffers` detection introduced by the
previous patch `0017-fix-flatbuffers.patch`, which has correctly fixed
the `flatbuffers`-related issues.

```patch
...
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -756,7 +756,7 @@ include(cmake/OpenCVFindLibsVideo.cmake)
 include(cmake/OpenCVFindLibsPerf.cmake)
 include(cmake/OpenCVFindLAPACK.cmake)
 include(cmake/OpenCVFindProtobuf.cmake)
-include(cmake/OpenCVDetectFlatbuffers.cmake)
+find_package(flatbuffers CONFIG REQUIRED)
...
```

In `vcpkg/ports/opencv4/vcpkg.json` we can see, `flatbuffers` is only
the dependency of feature `dnn`:

```json
  "dependencies": [
...
    "dnn": {
      "description": "Enable dnn module",
      "dependencies": [
        "flatbuffers",
        {
          "name": "flatbuffers",
          "host": true,
          "default-features": false
        },
        "protobuf"
      ]
    },
...
```

and when `dnn` is not enabled, it broke down at the line
`find_package(flatbuffers CONFIG REQUIRED)`

And this change is unnecessary either:

```patch
-  list(APPEND libs ocv.3rdparty.flatbuffers)
+  list(APPEND libs flatbuffers::flatbuffers)
```

Thus, we'd better to revert those changes.

Co-authored-by: WentsingNee <8090395+wentsingnee@user.noreply.gitee.com>
2024-05-07 20:38:17 -07:00
..
2023-10-18 10:35:37 -07:00
2023-09-20 10:23:18 -07:00
2023-11-22 14:33:43 -08:00
2024-03-19 13:06:43 -07:00
2024-03-12 09:41:18 -07:00
2024-03-11 13:07:35 -07:00
2024-03-13 16:44:39 -07:00
2024-04-11 10:58:24 -04:00
2024-04-30 11:50:26 -07:00
2024-04-19 07:55:28 -04:00
2024-04-01 15:34:36 -07:00
2024-03-13 16:40:48 -07:00