Detect OpenCV 4.x

This commit is contained in:
John Zhao 2018-06-05 15:00:44 +08:00
parent 9451fdd90c
commit 3e96e56d8b
2 changed files with 7 additions and 1 deletions

View File

@ -19,8 +19,10 @@ find_package(OpenCV REQUIRED)
message(STATUS "Found OpenCV: ${OpenCV_VERSION}") message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
if(OpenCV_VERSION VERSION_LESS 3.0) if(OpenCV_VERSION VERSION_LESS 3.0)
add_definitions(-DUSE_OPENCV2) add_definitions(-DUSE_OPENCV2)
else() elseif(OpenCV_VERSION VERSION_LESS 4.0)
add_definitions(-DUSE_OPENCV3) add_definitions(-DUSE_OPENCV3)
else()
add_definitions(-DUSE_OPENCV4)
endif() endif()
if(MSVC OR MSYS OR MINGW) if(MSVC OR MSYS OR MINGW)

View File

@ -30,8 +30,12 @@ make_executable(camera_a
## get_depth_with_region ## get_depth_with_region
if(OpenCV_VERSION VERSION_LESS 4.0)
make_executable(get_depth_with_region make_executable(get_depth_with_region
SRCS get_depth_with_region.cc SRCS get_depth_with_region.cc
LINK_LIBS mynteye ${OpenCV_LIBS} LINK_LIBS mynteye ${OpenCV_LIBS}
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
) )
endif()