diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2017 The Bitcoin developers -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_SOURCE_DIR}/cmake/modules/OverrideInitFlags.cmake" diff --git a/contrib/debian/control b/contrib/debian/control --- a/contrib/debian/control +++ b/contrib/debian/control @@ -3,7 +3,7 @@ Priority: optional Maintainer: Bitcoin ABC Package Maintainers Uploaders: Jason B. Cox -Build-Depends: cmake (>= 3.13), +Build-Depends: cmake (>= 3.16), debhelper (>=12.1), devscripts, git, diff --git a/contrib/teamcity/setup-debian-buster.sh b/contrib/teamcity/setup-debian-buster.sh --- a/contrib/teamcity/setup-debian-buster.sh +++ b/contrib/teamcity/setup-debian-buster.sh @@ -14,7 +14,6 @@ bsdmainutils build-essential ccache - cmake cppcheck curl flake8 @@ -80,6 +79,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${PACKAGES[@]}") BACKPORTS=( + cmake shellcheck ) diff --git a/doc/build-unix.md b/doc/build-unix.md --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -62,7 +62,15 @@ sudo apt-get install bsdmainutils build-essential libssl-dev libevent-dev ninja-build python3 -On Debian Buster (10) or Ubuntu 19.04 and later: +**Installing cmake:** + +On Debian Buster (10), `cmake` should be installed from the backports repository: + + echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list + sudo apt-get update + sudo apt-get -t buster-backports install cmake + +On Ubuntu 20.04 and later: sudo apt-get install cmake diff --git a/doc/dependencies.md b/doc/dependencies.md --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -8,7 +8,7 @@ | Berkeley DB | [5.3.28](http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 5.3 | No | | | | Boost | [1.70.0](https://www.boost.org/users/download/) | 1.59.0 | No | | | | Clang | | [3.4](https://releases.llvm.org/download.html) (C++14 support) | | | | -| CMake | | [3.13](https://cmake.org/download/) | | | | +| CMake | | [3.16](https://cmake.org/download/) | | | | | Expat | [2.2.7](https://libexpat.github.io/) | | No | Yes | | | fontconfig | [2.12.6](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | | FreeType | [2.7.1](http://download.savannah.gnu.org/releases/freetype) | | No | | | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -153,19 +153,9 @@ add_linker_flags(-Wl,-z,relro -Wl,-z,now) # CMake provides the POSITION_INDEPENDENT_CODE property to set PIC/PIE. - # Unfortunately setting the -pie linker flag this way require CMake >= 3.14, - # which is not widely distributed at the time of writing. - # FIXME: remove the fallback case when cmake >= 3.14 get enforced. - if(POLICY CMP0083) - cmake_policy(SET CMP0083 NEW) - include(CheckPIESupported) - check_pie_supported() - elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - check_linker_flag(PIE_IS_SUPPORTED -pie) - if(${PIE_IS_SUPPORTED}) - add_link_options($<$,EXECUTABLE>:-pie>) - endif() - endif() + cmake_policy(SET CMP0083 NEW) + include(CheckPIESupported) + check_pie_supported() if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") # MinGw provides its own libssp for stack smashing protection @@ -373,16 +363,7 @@ set(Boost_THREADAPI win32) find_package(SHLWAPI REQUIRED) - # We cannot use the imported target here, because cmake will introduce an - # -isystem compilation directive and cause the build to fail with MinGw. - # This comes from a couple cmake bugs: - # - https://gitlab.kitware.com/cmake/cmake/issues/16291 - # - https://gitlab.kitware.com/cmake/cmake/issues/19095 - # These issues are solved from cmake 3.14.1. Once this version is enforced, - # the following can be used: - # target_link_libraries(util SHLWAPI::shlwapi) - target_link_libraries(util ${SHLWAPI_LIBRARIES}) - target_include_directories(util PUBLIC ${SHLWAPI_INCLUDE_DIRS}) + target_link_libraries(util SHLWAPI::shlwapi) find_library(WS2_32_LIBRARY NAMES ws2_32) target_link_libraries(util ${WS2_32_LIBRARY}) diff --git a/src/leveldb/CMakeLists.txt b/src/leveldb/CMakeLists.txt --- a/src/leveldb/CMakeLists.txt +++ b/src/leveldb/CMakeLists.txt @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. See the AUTHORS file for names of contributors. -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project(Leveldb VERSION 0.1.0 LANGUAGES C CXX) # This project can take advantage of C++11. @@ -89,16 +89,7 @@ ) find_package(SHLWAPI REQUIRED) - # We cannot use the imported target here, because cmake will introduce an - # -isystem compilation directive and cause the build to fail with MinGw. - # This comes from a couple cmake bugs: - # - https://gitlab.kitware.com/cmake/cmake/issues/16291 - # - https://gitlab.kitware.com/cmake/cmake/issues/19095 - # These issues are solved from cmake 3.14.1. Once this version is enforced, - # the following can be used: - # target_link_libraries(leveldb SHLWAPI::shlwapi) - target_link_libraries(leveldb ${SHLWAPI_LIBRARIES}) - target_include_directories(leveldb PUBLIC ${SHLWAPI_INCLUDE_DIRS}) + target_link_libraries(leveldb SHLWAPI::shlwapi) else() set(LEVELDB_PLATFORM POSIX) target_sources(leveldb PRIVATE port/port_posix.cc) diff --git a/src/secp256k1/CMakeLists.txt b/src/secp256k1/CMakeLists.txt --- a/src/secp256k1/CMakeLists.txt +++ b/src/secp256k1/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2017 The Bitcoin developers -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project(secp256k1 LANGUAGES C VERSION 0.1.0) # Add path for custom modules when building as a standalone project diff --git a/src/univalue/CMakeLists.txt b/src/univalue/CMakeLists.txt --- a/src/univalue/CMakeLists.txt +++ b/src/univalue/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2017 The Bitcoin developers -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) project(univalue) option(UNIVALUE_BUILD_TESTS "Build univalue's unit tests" ON)