Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

# We support CMake 3.12, but prefer 3.27 policies and behavior
cmake_minimum_required(VERSION 3.12...3.27)
# We support CMake 3.10, but prefer 4.4 policies and behavior
cmake_minimum_required(VERSION 3.10...4.4)

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

Expand All @@ -28,6 +28,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

# Fetch support files

# BoostFetch.cmake still uses FetchContent_Populate, an error under CMP0169 NEW
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

message(STATUS "Fetching BoostFetch.cmake")

file(DOWNLOAD
Expand Down Expand Up @@ -84,7 +89,12 @@ if (BUILD_TESTING)
# do not pollute the superproject with the benchmarks
if(NOT BOOST_SUPERPROJECT_VERSION)

add_subdirectory(benchmark)
# google/benchmark requires CMake 3.13
if(CMAKE_VERSION VERSION_LESS 3.13)
message(STATUS "CMake 3.13+ required by google/benchmark; skipping benchmarks")
else()
add_subdirectory(benchmark)
endif()

endif()

Expand Down
21 changes: 13 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

find_package(Python3 COMPONENTS Interpreter)
if (Python3_FOUND)
# checks that b2 and cmake are in sync
add_test(NAME runpy-${PROJECT_NAME}_check_build_system COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_build_system.py)

# checks that all headers are included in odr test
add_test(NAME runpy-${PROJECT_NAME}_check_odr_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_odr_test.py)
# FindPython3 requires CMake 3.12
if (CMAKE_VERSION VERSION_LESS 3.12)
message(STATUS "CMake 3.12+ required to check for odr violations and build system consistency")
else()
MESSAGE(WARNING "Python interpreter not found, cannot check for odr violations and build system consistency")
find_package(Python3 COMPONENTS Interpreter)
if (Python3_FOUND)
# checks that b2 and cmake are in sync
add_test(NAME runpy-${PROJECT_NAME}_check_build_system COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_build_system.py)

# checks that all headers are included in odr test
add_test(NAME runpy-${PROJECT_NAME}_check_odr_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_odr_test.py)
else()
message(WARNING "Python interpreter not found, cannot check for odr violations and build system consistency")
endif()
endif()

include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
Expand Down
Loading