set(L_SML_LIB sml)

file(GLOB_RECURSE SOURCES "*.cpp")
add_library(${L_SML_LIB} SHARED ${SOURCES})
if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
    target_include_directories(${L_SML_LIB}
        PUBLIC ${LUACLIB_SRC_DIR}
        PUBLIC ${CONAN_INCLUDE_DIRS}
        PUBLIC ${GLIB_INCLUDE_DIRS}
    )
    target_link_libraries(${L_SML_LIB}
        PUBLIC ${GLIB_LIBRARIES}
        PUBLIC platform
        PUBLIC ${CONAN_LIBS_HUAWEI_SECURE_C}
        PUBLIC ${GLIB2_LIBRARIES}
        PUBLIC logging
        PUBLIC cutils
        PUBLIC ${CONAN_LIBS_JSON}
    )
else()
    target_include_directories(${L_SML_LIB}
        PUBLIC ${LUACLIB_SRC_DIR}
        PUBLIC ${CONAN_INCLUDE_DIRS}
        PUBLIC ${GLIB_INCLUDE_DIRS}
        PUBLIC ${libmgmt_protocol_INCLUDE_DIRS}
    )
    target_link_libraries(${L_SML_LIB}
        PUBLIC ${GLIB_LIBRARIES}
        PUBLIC ${CONAN_LIBS_HUAWEI_SECURE_C}
        PUBLIC ${GLIB2_LIBRARIES}
        PUBLIC libmc4lua::libmc4lua
        PUBLIC huawei_secure_c::huawei_secure_c
        PUBLIC skynet::skynet
        PUBLIC libmgmt_protocol::libplatform
        PUBLIC json::json
        PUBLIC liblogger::liblogger
    )
endif()
set_target_properties(${L_SML_LIB} PROPERTIES PREFIX "")
install(TARGETS ${L_SML_LIB} DESTINATION opt/bmc/luaclib)
