Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macos build #15982

Merged
merged 4 commits into from
Apr 8, 2025
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
3 changes: 0 additions & 3 deletions .circleci/osx_install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ then
brew install openjdk@11
brew install unzip

# writing to /usr/local/lib need administrative privileges.
sudo ./scripts/install_obsolete_jsoncpp_1_7_4.sh

# boost
boost_version="1.84.0"
boost_package="boost_${boost_version//./_}.tar.bz2"
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ endif()

find_package(Threads)

if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if (CMAKE_VERSION VERSION_EQUAL "4.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "15.0.0.15000040")
# for Apple clang 15 under cmake 4.0.0, disable pedantic warnings explicitly as it fails to treat boost properly as
# system library, warnings propagate
set(PEDANTIC OFF)
endif()
endif()

if(NOT PEDANTIC)
message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
endif()
Expand Down
18 changes: 15 additions & 3 deletions cmake/EthDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,27 @@ endif()

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

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

# If cmake is older than boost and boost is older than 1.70,
Expand All @@ -49,8 +62,7 @@ if (NOT TARGET Boost::boost) # header only target
add_library(Boost::boost INTERFACE IMPORTED)
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
endif()
get_property(LOCATION TARGET Boost::boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found Boost headers in ${LOCATION}")
message(STATUS "Found Boost ${Boost_VERSION} headers in ${Boost_INCLUDE_DIRS}")

foreach (BOOST_COMPONENT IN LISTS BOOST_COMPONENTS)
if (NOT TARGET Boost::${BOOST_COMPONENT})
Expand Down
24 changes: 0 additions & 24 deletions scripts/install_obsolete_jsoncpp_1_7_4.sh

This file was deleted.