diff --git a/.circleci/osx_install_dependencies.sh b/.circleci/osx_install_dependencies.sh index e7a0b9ddfda2..6e0c859f9ace 100755 --- a/.circleci/osx_install_dependencies.sh +++ b/.circleci/osx_install_dependencies.sh @@ -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" diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b39878f26d3..29bf2b0ca663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 87a5e1b5e17e..f79140dd29d9 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -31,6 +31,10 @@ 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 @@ -38,7 +42,16 @@ if (WIN32) 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, @@ -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}) diff --git a/scripts/install_obsolete_jsoncpp_1_7_4.sh b/scripts/install_obsolete_jsoncpp_1_7_4.sh deleted file mode 100755 index f9de0245d70b..000000000000 --- a/scripts/install_obsolete_jsoncpp_1_7_4.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -eu - -TEMPDIR=$(mktemp -d) -( - cd "$TEMPDIR" - jsoncpp_version="1.7.4" - jsoncpp_package="jsoncpp-${jsoncpp_version}.tar.gz" - jsoncpp_sha256=10dcd0677e80727e572a1e462193e51a5fde3e023b99e144b2ee1a469835f769 - wget -O "$jsoncpp_package" https://github.com/open-source-parsers/jsoncpp/archive/${jsoncpp_version}.tar.gz - if ! [ "$(sha256sum "$jsoncpp_package")" = "${jsoncpp_sha256} ${jsoncpp_package}" ] - then - >&2 echo "ERROR: Downloaded jsoncpp source package has wrong checksum." - exit 1 - fi - tar xvzf "$jsoncpp_package" - cd "jsoncpp-${jsoncpp_version}" - mkdir -p build - cd build - cmake -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" .. - make - make install -) -rm -r "$TEMPDIR"