# Generated by `boostdep --cmake type_index`
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.31)

project(boost_type_index VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

if (BOOST_USE_MODULES)
    add_library(boost_type_index)
    target_sources(boost_type_index PUBLIC
        FILE_SET modules_public TYPE CXX_MODULES FILES modules/boost_type_index.cppm
    )

    target_compile_features(boost_type_index PUBLIC cxx_std_20)
    target_compile_definitions(boost_type_index PUBLIC BOOST_USE_MODULES)
    if (CMAKE_CXX_COMPILER_IMPORT_STD)
        target_compile_definitions(boost_type_index PRIVATE BOOST_TYPE_INDEX_USE_STD_MODULE)
        message(STATUS "Using `import std;`")
    else()
        message(STATUS "`import std;` is not awailable")
    endif()
    set(__scope PUBLIC)
else()
    add_library(boost_type_index INTERFACE)
    set(__scope INTERFACE)
endif()

target_include_directories(boost_type_index ${__scope} include)
add_library(Boost::type_index ALIAS boost_type_index)

target_link_libraries(boost_type_index
  ${__scope}
    Boost::config
    Boost::container_hash
    Boost::core
    Boost::throw_exception
)

if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

  add_subdirectory(test)

endif()
