# We found that AGP could not generate the correct cmake configuration
# when relying on a prefab package generated by another local project.
# We had to write one ourselves.
#
# Use it like this:
#
# if(DEPENDENCY_ON_LOCAL_LIBRARY)
#     include(${CMAKE_CURRENT_SOURCE_DIR}/../../../../xdl/local_dependency.cmake)
# else()
#     find_package(xdl REQUIRED CONFIG)
# endif()
#
# target_link_libraries(myapp xdl::xdl)
#

string(TOLOWER ${CMAKE_BUILD_TYPE} XDL_BUILD_TYPE_DIRNAME)
if(${XDL_BUILD_TYPE_DIRNAME} STREQUAL "relwithdebinfo")
    set(XDL_BUILD_TYPE_DIRNAME "release")
endif()

set(XDL_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../../../xdl)

add_library(xdl::xdl SHARED IMPORTED)
set_target_properties(xdl::xdl PROPERTIES
        IMPORTED_LOCATION "${XDL_BASE}/build/intermediates/cmake/${XDL_BUILD_TYPE_DIRNAME}/obj/${ANDROID_ABI}/libxdl.so"
        INTERFACE_INCLUDE_DIRECTORIES "${XDL_BASE}/src/main/cpp/include"
        INTERFACE_LINK_LIBRARIES ""
)
