cmake_minimum_required(VERSION 3.16) project(notebook_calibration_examples LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs) if(OpenCV_VERSION_MAJOR GREATER_EQUAL 5) find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs geometry calib) else() find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs calib3d) endif() foreach(example camera_calibration handeye_calibration) add_executable(${example} ${example}.cpp) target_include_directories(${example} PRIVATE ${OpenCV_INCLUDE_DIRS}) target_link_libraries(${example} PRIVATE ${OpenCV_LIBS}) target_compile_options(${example} PRIVATE -Wall -Wextra -Wpedantic) endforeach() enable_testing() add_test(NAME camera_synthetic COMMAND camera_calibration) add_test(NAME camera_degenerate COMMAND camera_calibration --degenerate) add_test(NAME handeye_synthetic COMMAND handeye_calibration) add_test(NAME handeye_degenerate COMMAND handeye_calibration --degenerate) set_tests_properties(camera_degenerate handeye_degenerate PROPERTIES WILL_FAIL TRUE)