﻿
# =========== 3rdparty atframe_utils ==================
if(NOT ATFRAMEWORK_ATFRAME_UTILS_BASE_DIR)
    set (ATFRAMEWORK_ATFRAME_UTILS_BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()

# make 3rd party detect
set (3RD_PARTY_ATFRAME_UTILS_BASE_DIR ${ATFRAMEWORK_ATFRAME_UTILS_BASE_DIR})

if (ATFRAME_UTILS_ROOT)
    set (ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR ${ATFRAME_UTILS_ROOT})
else()
    set (ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR "${CMAKE_CURRENT_LIST_DIR}/repo")
    if(NOT EXISTS ${ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR})
        find_package(Git)
        if(NOT GIT_FOUND)
            message(FATAL_ERROR "git not found")
        endif()

        file(RELATIVE_PATH ATFRAMEWORK_ATFRAME_UTILS_GIT_SUBMODULE_PATH ${CMAKE_SOURCE_DIR} ${ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR})
        execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init ${ATFRAMEWORK_ATFRAME_UTILS_GIT_SUBMODULE_PATH}
            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        )
    endif()

    set (ATFRAME_UTILS_ROOT ${ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR})
endif()

set (ATFRAMEWORK_ATFRAME_UTILS_INC_DIR "${ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR}/include")
set (ATFRAMEWORK_ATFRAME_UTILS_SRC_DIR "${ATFRAMEWORK_ATFRAME_UTILS_REPO_DIR}/src")
set (ATFRAMEWORK_ATFRAME_UTILS_LINK_NAME atframe_utils)