I have the following toolchain…
CMake(c++)(3.26.1) → OpenCV(4.6.0) → CudaToolkit(11.7) all on Ubuntu 22.04.
when I run cmake on my CMakeList.txt I get the following error…
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find CUDA: Found unsuitable version “11.7”, but required is exact
version “11.5” (found /usr/local/cuda)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:592 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindCUDA.cmake:1264 (find_package_handle_standard_args)
/usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:86 (find_package)
/usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:108 (find_host_package)
CMakeLists.txt:18 (find_package)
How is cmake determining that I must have cuda 11.5?
CMakeList.txt text below
cmake for OpenCV2 Cookbook
your opencv/build directory should be in your system PATH
set minimum required version for cmake
cmake_minimum_required(VERSION 2.8)
define the project name
set(project_name “Sharpen”)
set the project name
project(“${project_name}”)
this is a C++11 project
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++11”)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -g”)
add opencv package to the project
find_package( OpenCV REQUIRED )
INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} … )
SET(OpenCV_LIBRARIES ${OpenCV_LIBS})
message(STATUS “OpenCV library status:”)
message(STATUS " version: ${OpenCV_VERSION}“)
message(STATUS " libraries: ${OpenCV_LIBS}”)
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
#SET(INCLUDES ) ${CMAKE_SOURCE_DIR}/linedetect.h )
#FILE(COPY $(INCLUDES) DESTINATION .)
SET (IMAGES ${CMAKE_SOURCE_DIR}/007.mp4 ${CMAKE_SOURCE_DIR}/007_shapshot.png ${CMAKE_SOURCE_DIR}/RawToMp4_snapshot.png ${CMAKE_SOURCE_DIR}/shapes.png)
FILE(COPY ${IMAGES} DESTINATION .)
add_executable( sharpen sharpen.cpp contour.cpp )
target_link_libraries( sharpen ${OpenCV_LIBS})