cmake_minimum_required(VERSION 3.9) project(filmout_display) set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) set(TESTING_ON FALSE) find_package(OpenGL REQUIRED) find_package(GLUT REQUIRED) find_package(OpenCV HINTS /usr/local/opt/opencv /usr/local/Cellar/opencv REQUIRED) file(GLOB SOURCES "src/*.cpp") if(${TESTING_ON}) ENABLE_TESTING() ADD_SUBDIRECTORY( test ) SET(UNIT_TEST state_test) add_test(NAME ${UNIT_TEST} COMMAND ${UNIT_TEST}) add_custom_target(run_unit_test ALL COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure DEPENDS ${UNIT_TEST}) endif() set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) add_executable( fd ${SOURCES} ) target_include_directories(fd PRIVATE include) if (APPLE) # Equivalent to pass flags -framework OpenGL target_link_libraries(fd OpenGL::GL GLUT::GLUT ${OpenCV_LIBS} pthread) else() target_link_libraries(fd GL GLU glut ${OpenCV_LIBS} pthread) endif()