
# ==========================================
#   Copyright (c) 2016-2021 dynamic_ctatic
#       Licensed under the MIT license
#     http://opensource.org/licenses/MIT
# ==========================================

include(FetchContent)

FetchContent_Declare(
    stb
    GIT_REPOSITORY "https://github.com/nothings/stb.git"
    GIT_TAG af1a5bc352164740c1cc1354942b1c6b72eacb8a
    GIT_PROGRESS TRUE
    FETCHCONTENT_UPDATES_DISCONNECTED
)
FetchContent_MakeAvailable(stb)
FetchContent_GetProperties(stb SOURCE_DIR stbSourceDirectory)
FetchContent_GetProperties(stb BINARY_DIR stbBinaryDirectory)
macro(add_stb_file stbFile)
    file(COPY "${stbSourceDirectory}/${stbFile}" DESTINATION "${stbBinaryDirectory}/stb/")
    list(APPEND includeFiles "${stbBinaryDirectory}/stb/${stbFile}")
endmacro()
add_stb_file(stb_image.h)
add_stb_file(stb_truetype.h)
dst_add_interface_library(
    target stb
    includeDirectories PUBLIC "${stbBinaryDirectory}/"
    includeFiles "${includeFiles}"
)
set_target_properties(stb PROPERTIES FOLDER "dynamic_static/external/")
