Skip to content

Instantly share code, notes, and snippets.

@paulobunga
Created January 8, 2024 08:45
Show Gist options
  • Select an option

  • Save paulobunga/d39d47a8d6eb00991d7fe8bc33255a80 to your computer and use it in GitHub Desktop.

Select an option

Save paulobunga/d39d47a8d6eb00991d7fe8bc33255a80 to your computer and use it in GitHub Desktop.
CMake Setup for CLion Windows OpenCV
cmake_minimum_required(VERSION 3.25)
project(ProjectName)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(OpenCV_DIR "C:/tools/opencv/build/x64/vc16/lib")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(ProjectName main.cpp)
target_link_libraries(ProjectName ${OpenCV_LIBS})
@paulobunga
Copy link
Author

Download OpenCV from the official website’s download page, extract it to your preferred location, and ensure CMake is installed and added to your system's PATH.

Additionally, don't forget to add OpenCV to your PATH.

i.e C:\tools\opencv\build\x64\vc16\bin and C:\Program Files\CMake\bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment