Skip to content

Commit 6da61ca

Browse files
authored
Merge pull request #15982 from ethereum/fix_macos_build
Fix macos build
2 parents 949a52f + 4c23d04 commit 6da61ca

File tree

4 files changed

+23
-30
lines changed

4 files changed

+23
-30
lines changed

.circleci/osx_install_dependencies.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ then
5959
brew install openjdk@11
6060
brew install unzip
6161

62-
# writing to /usr/local/lib need administrative privileges.
63-
sudo ./scripts/install_obsolete_jsoncpp_1_7_4.sh
64-
6562
# boost
6663
boost_version="1.84.0"
6764
boost_package="boost_${boost_version//./_}.tar.bz2"

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ endif()
7070

7171
find_package(Threads)
7272

73+
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
74+
if (CMAKE_VERSION VERSION_EQUAL "4.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "15.0.0.15000040")
75+
# for Apple clang 15 under cmake 4.0.0, disable pedantic warnings explicitly as it fails to treat boost properly as
76+
# system library, warnings propagate
77+
set(PEDANTIC OFF)
78+
endif()
79+
endif()
80+
7381
if(NOT PEDANTIC)
7482
message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
7583
endif()

cmake/EthDependencies.cmake

Lines changed: 15 additions & 3 deletions
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,
@@ -49,8 +62,7 @@ if (NOT TARGET Boost::boost) # header only target
4962
add_library(Boost::boost INTERFACE IMPORTED)
5063
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
5164
endif()
52-
get_property(LOCATION TARGET Boost::boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
53-
message(STATUS "Found Boost headers in ${LOCATION}")
65+
message(STATUS "Found Boost ${Boost_VERSION} headers in ${Boost_INCLUDE_DIRS}")
5466

5567
foreach (BOOST_COMPONENT IN LISTS BOOST_COMPONENTS)
5668
if (NOT TARGET Boost::${BOOST_COMPONENT})

scripts/install_obsolete_jsoncpp_1_7_4.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)