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

cmake_minimum_required(VERSION 3.10...3.31)

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

add_library(boost_sort INTERFACE)
add_library(Boost::sort ALIAS boost_sort)

target_include_directories(boost_sort INTERFACE include)

target_link_libraries(boost_sort
  INTERFACE
    Boost::config
    Boost::core
    Boost::range
    Boost::type_traits
)

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)

  message(STATUS "Using CMake version ${CMAKE_VERSION}")

  set(Boost_DEBUG ON)
  find_package(Boost 1.85 CONFIG REQUIRED COMPONENTS core range included_test_exec_monitor)

  include(CTest)

  add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
  add_dependencies(check tests)

endif()

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

  # Follow the Boost convention: don't build test targets by default,
  # and only when explicitly requested by building target tests
  add_subdirectory(test EXCLUDE_FROM_ALL)

endif()
