if (NOT pylon_FOUND)
    find_package(pylon 6.2 REQUIRED)
endif()

if (NOT OpenCV_FOUND)
    find_package(OpenCV REQUIRED)
endif()

if (NOT PCL_FOUND)
    find_package(PCL QUIET REQUIRED COMPONENTS common visualization filters)
endif()

if (NOT Boost_program_options_FOUND)
    find_package(Boost QUIET COMPONENTS program_options REQUIRED)
endif()

add_executable(DepthFusion Fusion.cpp)
target_link_libraries(DepthFusion pylon::pylon ${OpenCV_LIBS} ${PCL_LIBRARIES} Boost::program_options)
target_include_directories(DepthFusion PRIVATE ${OpenCV_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})
# Suppress warnings from PCL/VTK header files.
target_compile_options(DepthFusion PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-comment>)

string(STRIP "${PCL_DEFINITIONS}" PCL_DEFINITIONS)
target_compile_definitions(DepthFusion PRIVATE ${PCL_DEFINITIONS} CALIBRATION_DIR="${CMAKE_CURRENT_SOURCE_DIR}/../CalibrationData/")

if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
    target_link_directories(DepthFusion PRIVATE ${PCL_LIBRARY_DIRS})
else()
    link_directories(${PCL_LIBRARY_DIRS})
endif()
