CMakeLists.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright 2018 Mike Dev
  2. # Copyright 2018 Peter Dimov
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
  5. # Partial (add_subdirectory only) and experimental CMake support
  6. # Subject to change; please do not rely on the contents of this file yet
  7. cmake_minimum_required(VERSION 3.5)
  8. project(BoostAssert VERSION 1.72.0 LANGUAGES CXX)
  9. add_library(boost_assert INTERFACE)
  10. add_library(Boost::assert ALIAS boost_assert)
  11. target_include_directories(boost_assert INTERFACE include)
  12. target_link_libraries(boost_assert
  13. INTERFACE
  14. Boost::config
  15. )
  16. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
  17. # `function` confuses FetchContent, sees empty CMAKE_CURRENT_LIST_DIR
  18. macro(fetch_and_include name)
  19. message(STATUS "Fetching ${name}")
  20. file(DOWNLOAD
  21. "https://raw.githubusercontent.com/pdimov/mincmake/master/${name}"
  22. "${CMAKE_BINARY_DIR}/fetch_and_include/${name}"
  23. )
  24. include("${CMAKE_BINARY_DIR}/fetch_and_include/${name}")
  25. endmacro()
  26. fetch_and_include(cmake/boost_fetch.cmake)
  27. fetch_and_include(cmake/boost_test.cmake)
  28. boost_fetch(boostorg/config TAG develop)
  29. boost_fetch(boostorg/core TAG develop)
  30. enable_testing()
  31. add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
  32. endif()
  33. if(COMMAND boost_test)
  34. add_subdirectory(test)
  35. endif()