0

I was using CMake to configure and generate for setting up darknet and the configuration failed, I got this error.

CMake Warning at CMakeLists.txt:103 (find_package): By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but CMake did not find one.

Could not find a package configuration file provided by "OpenCV" with any of the following names:

OpenCVConfig.cmake
opencv-config.cmake

Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files. If "OpenCV" provides a separate development package or SDK, be sure it has been installed.

I'm using Visual Studio 15 2017 and x64 for the configuration and it does not work

img 1 img 2

If there is any files or things needed for more clarification, I'll share them

SeanLink11
  • 23
  • 1
  • 8
  • As you correctly noted by the tag, the error message is about OpenCV. Do you have OpenCV installed? How have you installed it? – Tsyvarev Jul 04 '20 at 22:05
  • @Tsyvarev I did installed it, I installed it from source and there was no errors – SeanLink11 Jul 05 '20 at 04:20
  • 1
    Ok, then what about suggestions in the error message - "Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files.", have you tried them? What (and how) exactly have you tried? – Tsyvarev Jul 05 '20 at 09:22
  • I even tried with adding an environment variable to the system and it does not work – SeanLink11 Jul 05 '20 at 11:00
  • @Tsyvarev Can you guide me on how to add those? – SeanLink11 Jul 05 '20 at 11:01
  • See e.g. [that question](https://stackoverflow.com/questions/27127153/cmake-error-at-cmakelists-txt-cmake-prefix-path) and answer for it. Parameters passed to `cmake` via `-D` option could be set via GUI (find e.g. `OpenCV_DIR` record in the list, and edit it appropriately). – Tsyvarev Jul 05 '20 at 11:13
  • So, does it mean that I can run the command **cmake -DOpenCV_DIR="D:\MobileClass\OpenCV\build\win-install\x64\vc15\lib" ..** exactly to fix it? – SeanLink11 Jul 05 '20 at 12:40
  • Why ask when you could try? – Tsyvarev Jul 05 '20 at 12:55
  • Hi, when i run it, it mentioned that I needed to add **cmake_minimum_required(VERSION .)** in CMakeLists.txt file and when I added it, it still gives the same error that I need to add that line of command – SeanLink11 Jul 06 '20 at 00:48
  • @Tsyvarev ok, I added a version and moved my manifest file to the directory, now it has the error **CMake Error at CMakeLists.txt:7 (project): VERSION not allowed unless CMP0048 is set to NEW** – SeanLink11 Jul 06 '20 at 00:58
  • Please, do NOT format code and logs as a *blockquote*: this formatting loses newlines, so result is very hard to read. Paste code and logs again into the question post, and format them as a **code** (with `Ctrl+K` or `{}` button). – Tsyvarev Jul 06 '20 at 06:28
  • ok, I changed it to **code** format – SeanLink11 Jul 06 '20 at 10:24
  • In your re-formatted code you have a very long line started with `# include(manifest.cmake)`. This is actually several lines, and probably they should be uncommented. Note, that every CMake project should have calls to `cmake_minimum_required` and `project` and **exactly in that order**. BTW, what is a reason to post `CMakeLists.txt` which has **nothing common** with the error you ask about? The error is about OpenCV, but the code has no notion about OpenCV. What do you want from us with the current content of the question post? With which problem do you need our help? – Tsyvarev Jul 06 '20 at 12:40
  • Hi, I uncomment the **include(manifest.cmake)** and rearrange the order like you said, and still got the error. I shared the **CMakeLists.txt** file because I followed the question you provided before and got an error saying the errors like **CMake Error at CMakeLists.txt:7 (project): VERSION not allowed unless CMP0048 is set to NEW** – SeanLink11 Jul 07 '20 at 00:11
  • "I shared the `CMakeLists.txt` file because I followed the question you provided before and got an error saying ..." - The [question I provided](https://stackoverflow.com/questions/27127153/cmake-error-at-cmakelists-txt-cmake-prefix-path) would help to fix the error about finding OpenCV, which you initially get when use CMake GUI. But that error cannot be emitted by the `CMakeLists.txt` you show, because it contains **nothing related** to OpenCV. Do you attempt to run `cmake -DOpenCV_DIR=<...>` in the **same build directory** (`D:\MobileClass\darknet\build)? – Tsyvarev Jul 07 '20 at 07:21
  • Please, update your question post with **actual actions** you do, **actual error message** you got, and, if it is caused by your code, then add **your code** into the question post. Otherwise it is simply unclear what do you ask. – Tsyvarev Jul 07 '20 at 07:25
  • Hi, thanks for your advice. I will use the question and try again, I'll update when I have any progress – SeanLink11 Jul 09 '20 at 10:14

0 Answers0