set(NCSI_PROTOCOL_INTF ncsi_protocol_intf)

file(GLOB_RECURSE SOURCES "*.c")
add_library(${NCSI_PROTOCOL_INTF} SHARED ${SOURCES})

if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
    target_include_directories(${NCSI_PROTOCOL_INTF}
        PUBLIC ${LUACLIB_SRC_DIR}
        PUBLIC ${CONAN_INCLUDE_DIRS}
        PUBLIC ${GLIB_INCLUDE_DIRS}
    )
    target_link_libraries(${NCSI_PROTOCOL_INTF}
        PUBLIC ${CONAN_LIBS_HUAWEI_SECURE_C}
        PUBLIC ${GLIB_LIBRARIES}
        PUBLIC ${CONAN_LIBS_LIBMC4LUA}
        PUBLIC logging
        PUBLIC ncsi_protocol
    )
else()
    target_include_directories(${NCSI_PROTOCOL_INTF}
        PUBLIC ${GLIB_INCLUDE_DIRS}
    )
    target_link_libraries(${NCSI_PROTOCOL_INTF}
        PUBLIC ${GLIB_LIBRARIES}
        PUBLIC skynet::skynet
        PUBLIC liblogger::liblogger
        PUBLIC libmgmt_protocol::libncsi_protocol
    )
endif()

set_target_properties(${NCSI_PROTOCOL_INTF} PROPERTIES PREFIX "")
install(TARGETS ${NCSI_PROTOCOL_INTF} DESTINATION opt/bmc/luaclib)
