Skip to content

Commit e6d5699

Browse files
committed
set CMP0167 to OLD behavior for boost versions < 1.70
1 parent f323bd4 commit e6d5699

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmake/EthDependencies.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,27 @@ endif()
3131

3232
set(BOOST_COMPONENTS "filesystem;unit_test_framework;program_options;system")
3333

34+
# CMake >= 3.30 should not use the vendored boost
35+
if(POLICY CMP0167)
36+
cmake_policy(SET CMP0167 NEW)
37+
endif()
3438
if (WIN32)
3539
# Boost 1.77 fixes a bug that causes crashes on Windows for some relative paths in --allow-paths.
3640
# See https://github.com/boostorg/filesystem/issues/201
3741
find_package(Boost 1.77.0 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
3842
else()
3943
# Boost 1.65 is the first to also provide boost::get for rvalue-references (#5787).
4044
# Boost 1.67 moved container_hash into is own module.
41-
find_package(Boost 1.67.0 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
45+
# Boost 1.70 comes with its own BoostConfig.cmake and is the new (non-deprecated) behavior
46+
find_package(Boost 1.70.0 QUIET COMPONENTS ${BOOST_COMPONENTS})
47+
if (NOT ${Boost_FOUND})
48+
# If the boost version is < 1.70.0, there is no boost config delivered with it, revert to old behavior
49+
# todo drop this once cmake minimum version >= 3.30 is reached
50+
if(POLICY CMP0167)
51+
cmake_policy(SET CMP0167 OLD)
52+
endif()
53+
find_package(Boost 1.67.0 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
54+
endif()
4255
endif()
4356

4457
# If cmake is older than boost and boost is older than 1.70,

0 commit comments

Comments
 (0)