- x86
vcpkg install opencv:x86-windows
- x64
vcpkg install opencv:x64-windows
Last active
June 12, 2024 00:21
-
-
Save UnaNancyOwen/5061d8c966178b753447e8a9f9ac8cf1 to your computer and use it in GitHub Desktop.
CMakeLists for OpenCV that installed using Vcpkg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required( VERSION 3.0 ) | |
set( CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ) | |
# Create Project | |
project( solution ) | |
add_executable( project main.cpp ) | |
# Set OpenCVConfig.cmake Search Directory | |
set( OpenCV_DIR ) | |
if( NOT CMAKE_CL_64 ) | |
set( OpenCV_DIR "C:/vcpkg/installed/x86-windows/share/opencv" ) | |
else() | |
set( OpenCV_DIR "C:/vcpkg/installed/x64-windows/share/opencv" ) | |
endif() | |
# Find Package | |
find_package( OpenCV REQUIRED ) | |
if( OpenCV_FOUND ) | |
# Additional Include Directories | |
include_directories( ${OpenCV_INCLUDE_DIRS} ) | |
# Additional Library Directories | |
link_directories( ${OpenCV_LIB_DIR} ) | |
# Additional Dependencies | |
target_link_libraries( project ${OpenCV_LIBS} ) | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you install opencv 4.2.0 for ubuntu 20.04? do you have a tag for that? vcpkg install opencv builds everything and i had to install some dependency manualy so far.
Computing installation plan...
The following packages will be built and installed:
opencv[core,default-features]:x64-linux -> 4.6.0