cmake_minimum_required(VERSION 3.8)
project(asio_vendor)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

include(FetchContent)
FetchContent_Declare(
  asio_vendor
  GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
  GIT_TAG asio-1-28-1
  GIT_SHALLOW TRUE
)

FetchContent_GetProperties(asio_vendor)
if (NOT asio_vendor_POPULATED)
  FetchContent_Populate(asio_vendor)

  message(STATUS "asio_vendor_SOURCE_DIR: ${asio_vendor_SOURCE_DIR}")
  install(
    DIRECTORY ${asio_vendor_SOURCE_DIR}/asio/include/
    DESTINATION include
    PATTERN ".gitignore" EXCLUDE          # 排除所有 txt 文件
    PATTERN "*.am" EXCLUDE                # 排除 docs 目录
  )

endif()