Those variables are determined by cmake (see OpenCVConfig.cmake
for a more detailed description of opencv CMake variables available).
To see those values you can add message()
calls after the find_package(OpenCV)
call to your project's CMakeLists.txt
:
find_package(OpenCV)
message(STATUS "OpenCV_INCLUDE_DIRS = ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV_LIBS = ${OpenCV_LIBS}")
Alternatively you can run find_package
via a CMake command line option.
Here are a few examples (the CMAKE_PREFIX_PATH
part is optional if CMake is not able to find your libraries installation path automatically):
MODE=COMPILE
giving include directories (e.g. with MSVC
compiler)
$ cmake
--find-package
-DNAME=OpenCV
-DCOMPILER_ID=MSVC -DMSVC_VERSION=1700
-DLANGUAGE=CXX
-DMODE=COMPILE
-DCMAKE_PREFIX_PATH:PATH=/path/to/your/OpenCV/build
MODE=LINK
giving link libraries (e.g. with GNU
compiler)
$ cmake
--find-package
-DNAME=OpenCV
-DCOMPILER_ID=GNU
-DLANGUAGE=CXX
-DMODE=LINK
-DCMAKE_PREFIX_PATH:PATH=/path/to/your/OpenCV/build
Note: This CMake call will create a CMakeFiles
sub-directory in your current working directory.
References