So I have a project which depends on opencv, which is installed with vcpkg. The project is build with cmake.
CMakeLists.txt
cmake_minimum_required(VERSION 3.19.1)
set(CMAKE_TOOLCHAIN_FILE ~/vcpkg/scripts/buildsystems/vcpkg.cmake)
project(mylib)
set (CMAKE_CXX_STANDARD 14)
find_package(OpenCV REQUIRED)
include_directories(~/vcpkg/installed/x64-osx/include)
link_libraries(${OpenCV_LIBS})
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
add_library(mylib SHARED mylib another_lib)
As can be seen, I'm trying to use the same CMakeLists.txt
to build it on macOS and Windows.
The link_libraries(${OpenCV_LIBS})
translates nicely between different OSs.
But include_directories(~/vcpkg/installed/x64-osx/include)
only works on macOS
, on Windows
it should refer to C:/vcpkg/installed/x64-windows/include
instead.
Is there any opecv/vcpkg I can use inlace of these?
CodePudding user response:
This include_directories(~/vcpkg/installed/x64-osx/include)
looks odd. This should be instead that:
include_directories(${OpenCV_INCLUDE_DIRS})