project(OwnDiagManagerSample)

add_executable(${PROJECT_NAME} main.cpp)

target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/OwnCommandProcessor)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/OwnDiagRuntimeSystem)

# or target_link_libraries(${PROJECT_NAME} libprotobuf)
target_link_libraries(${PROJECT_NAME} ${OtxDiagManager_DELIVERY_PATH}/lib/libprotobuf.lib)

target_link_libraries(${PROJECT_NAME} ${OtxDiagManager_DELIVERY_PATH}/lib/ProtoGen.lib)
target_link_libraries(${PROJECT_NAME} OwnCommandProcessor OwnDiagRuntimeSystem)

if(EXISTS "${OtxDiagManager_DELIVERY_PATH}/bin/OpenTestSystem.OtxDiagManager.Common.dll")
    add_custom_command(
        TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy
            "${OtxDiagManager_DELIVERY_PATH}/bin/OpenTestSystem.OtxDiagManager.Common.dll"
            "$<TARGET_FILE_DIR:${PROJECT_NAME}>/OpenTestSystem.OtxDiagManager.Common.dll"
    )

endif()

if(EXISTS "${OtxDiagManager_DELIVERY_PATH}/bin/botan.dll")
    add_custom_command(
        TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy
            "${OtxDiagManager_DELIVERY_PATH}/bin/botan.dll"
            "$<TARGET_FILE_DIR:${PROJECT_NAME}>/botan.dll"
    )

endif()