#
# This is CMakeLists for project: IndexList
#
project(IndexList)

# ${SRC} cmake file defines ${SOURCES} variable which holds all sources used during compilation
include_cmake(${SRC})

enable_all_warnings()
enable_warnings_as_errors()

add_library(IndexList SHARED ${SOURCES} $<TARGET_OBJECTS:IndexList_Objects>)

target_compile_definitions(IndexList
    PRIVATE
        INDEXLIST_EXPORTS
    INTERFACE
        INDEXLIST_IMPORTS)

target_include_directories(IndexList
    PRIVATE
        "${OPENIPC_ROOT}/Source/Public_Include"
        "${OPENIPC_ROOT}/Source/Foundation/IndexList_Static")

target_link_libraries(IndexList PRIVATE CommonUtils)

set_target_properties(IndexList PROPERTIES
                      OUTPUT_NAME IndexList_${ARCHITECTURE_NAME}
                      FOLDER "/Foundation")

ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/IndexList.def"
                   COMMAND ${PYTHON_EXECUTABLE} createdefifnewer.py ${CMAKE_CURRENT_BINARY_DIR}
                   COMMENT "Generating IndexList.def"
                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                   DEPENDS "../../Public_Include/Foundation/IndexList/IndexList.h")

install(TARGETS IndexList
        LIBRARY DESTINATION ${DPL_BIN_ROOT} COMPONENT openipc
        RUNTIME DESTINATION ${DPL_BIN_ROOT} COMPONENT openipc)

INSTALL_PDB(IndexList)

if(CONFIG_SHIP_PLUGINSDK)
    install(TARGETS IndexList
            ARCHIVE DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk
            LIBRARY DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk
            RUNTIME DESTINATION "${DPL_PROBEPLUGINSDK_LIBS}" COMPONENT probepluginsdk)

    INSTALL_PDB(IndexList)
endif()
