###### SPDLog ######
set(SPDLOG_INSTALL_DIR ${EXTERNAL_INSTALL_LOCATION}/spdlog)
set(SPDLOG_INCLUDE_DIR ${SPDLOG_INSTALL_DIR}/include)
set(SPDLOG_LIB_DIR ${SPDLOG_INSTALL_DIR}/lib)

set(SPDLOG_EXTRA_CXX_FLAGS "")

ExternalProject_Add(spdlog
    PREFIX      ${SPDLOG_INSTALL_DIR}
    INSTALL_DIR ${SPDLOG_INSTALL_DIR}
    GIT_REPOSITORY "https://github.com/gabime/spdlog.git"
    GIT_TAG "v1.9.2"
    CMAKE_ARGS
    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
    -DCMAKE_CXX_FLAGS=${SPDLOG_EXTRA_CXX_FLAGS}
    -DCMAKE_INSTALL_PREFIX:PATH=${SPDLOG_INSTALL_DIR}
    )
set(SPDLOG_FOUND TRUE)
set(SPDLOG_INCLUDE_DIRS ${SPDLOG_INCLUDE_DIR})
set(SPDLOG_LIBRARIES ${GFLAGS_LIBRARIES} ${SPDLOG_LIB_DIR}/libspdlog.a)
set(SPDLOG_LIBRARY_DIRS ${SPDLOG_LIBRARY_DIR})
set(SPDLOG_EXTERNAL TRUE)

include_directories(BEFORE SYSTEM ${SPDLOG_INCLUDE_DIR})
link_directories(${SPDLOG_LIB_DIR})

list(APPEND EXTERNAL_INCLUDES PUBLIC ${SPDLOG_INCLUDE_DIRS})
list(APPEND EXTERNAL_LIBS PUBLIC ${SPDLOG_LIBRARIES})

list(APPEND EXTERNAL_DEPENDENCIES spdlog)
