- x86
vcpkg install opencv:x86-windows
- x64
vcpkg install opencv:x64-windows
-
-
Save sonygod/1497c402b12fac8fcdca126c94dbaa26 to your computer and use it in GitHub Desktop.
CMakeLists for OpenCV that installed using Vcpkg
This file contains 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
cpp setting
you have to select vs2017 amd x64 for compile