cmake_minimum_required(VERSION 3.5)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++17")

project(opencvfr)

SET("OpenCV_DIR" ${CMAKE_CURRENT_SOURCE_DIR}/include/opencv/lib/cmake/opencv4)
set (GTEST_ROOT ${CMAKE_SOURCE_DIR}/include/gtest)
set( CMAKE_SKIP_BUILD_RPATH true )
find_package( OpenCV REQUIRED )
find_package( GTest REQUIRED )
find_package( OpenSSL REQUIRED )

message ("Gtest Include libraries" ${GTEST_INCLUDE_DIRS})
# message ("Gtest target libraries" ${GTEST_LIBS})

include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include 
                    ${CMAKE_CURRENT_SOURCE_DIR}/include/external
                    ${OpenCV_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})

# Configure to put executable in top level bin directory
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

# Get library implementation name
set (opencvfr $ENV{opencvfr})

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/gtest/lib)

# Build executable link to dependent libraries
add_executable (opencvfr example.cpp)
target_include_directories(opencvfr SYSTEM PUBLIC ${CMAKE_SOURCE_DIR}/include/gtest/include)
target_link_libraries (opencvfr gmock gtest pthread OpenSSL::SSL ${OpenCV_LIBS} ${API7Test})
