I have installed OpenCV in windows (from source)
Now I want to try a test so I have the following CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)
project(opencvGPUtest_youtube VERSION 0.1.0)
include(CTest)
enable_testing()
find_package(OpenCV REQUIRED )
include_directories(( ${OpenCV_INCLUDE_DIRS}))
add_executable(opencvGPUtest_youtube main.cpp)
target_link_libraries(opencvGPUtest_youtube ${OpenCV_LIBS})
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
However when I do cmake.. from a build folder I got
CMake Error at CMakeLists.txt:13 (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 have tried editing the CMakeLists.txt file to include the directory of Opencv as in
find_package(OpenCV REQUIRED PATH C:/Users/theuser/Path/To/MyOpenCVInstallation/build/install/x64/vc16/lib
or
find_package(OpenCV REQUIRED PATH C:/Users/theuser/Path/To/MyOpenCVInstallation/build/win-install/x64/vc16/lib
but still it cannot find OpenCV
I have also tried the -DOpenCV_DIR option, with no result
How can I make it recognize OpenCV?
EDIT:
When I specify OpenCV_DIR to MyOpenCVInstallation/build/install/x64/vc16/lib the error changes to
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenCV (missing: PATH
C:/Users/user/Path/To/MyOpenCVInstallation/build/install/) (found
version "4.5.2")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Users/user/path/to/MyOpenCVInstallation/build/install/x64/vc16/lib/OpenCVConfig.cmake:410 (find_package_handle_standard_args)
CMakeLists.txt:13 (find_package)
EDIT2:
Turns out that I had to use
find_package(OpenCV REQUIRED PATHS C:/Users/theuser/Path/To/MyOpenCVInstallation/build/install/x64/vc16/lib
With this it seems that the cmake goes ok.
However usually at this point (in ubuntu) I run make
but in windows I am supposed to use CtrlF5 from VSCode
now I got the output
-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code
with Visual Studio Code, Visual Studio or Visual Studio for Mac
software to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'C:\Users\aliag\DiskD\MyStudy\MyOpenCVInstallation\opencvgpu_test_youtube\build\Debug\opencvGPUtest_youtube.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'.
Loaded 'C:\Windows\System32\kernel32.dll'.
Loaded 'C:\Windows\System32\KernelBase.dll'.
Loaded 'C:\Windows\System32\apphelp.dll'.
Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
Loaded 'C:\Windows\System32\vcruntime140d.dll'.
Loaded 'C:\Windows\System32\msvcp140d.dll'.
The program '[1112] opencvGPUtest_youtube.exe' has exited with code -1073741515 (0xc0000135).
So I suppose that is matter of a different question?