From 3f966a213c9347eb4f5c6e88e610be4993114605 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 23 May 2025 16:25:36 +0200 Subject: [PATCH 1/2] Bump cmake policies all across --- build/fbcode_builder/getdeps/builder.py | 2 +- build/fbcode_builder/getdeps/py_wheel_builder.py | 2 +- cachelib/CMakeLists.txt | 2 +- examples/simple_cache/CMakeLists.txt | 2 +- examples/simple_compact_cache/CMakeLists.txt | 2 +- examples/single_tier_cache/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index b2d167dc64..21fe4893a5 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -1381,7 +1381,7 @@ def _build(self, reconfigure) -> None: copy_if_different(src, dest) cmake_lists = """ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5...4.0) project(sqlite3 C) add_library(sqlite3 STATIC sqlite3.c) # These options are taken from the defaults in Makefile.msc in diff --git a/build/fbcode_builder/getdeps/py_wheel_builder.py b/build/fbcode_builder/getdeps/py_wheel_builder.py index 7db5f2cb01..74c2b66490 100644 --- a/build/fbcode_builder/getdeps/py_wheel_builder.py +++ b/build/fbcode_builder/getdeps/py_wheel_builder.py @@ -21,7 +21,7 @@ ) CMAKE_HEADER = """ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...4.0) project("{manifest_name}" LANGUAGES C) diff --git a/cachelib/CMakeLists.txt b/cachelib/CMakeLists.txt index e17ff27c32..2937660506 100644 --- a/cachelib/CMakeLists.txt +++ b/cachelib/CMakeLists.txt @@ -17,7 +17,7 @@ # refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and # to the root binary directory of the project as ${HELLO_BINARY_DIR}. -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.12...4.0) ## TODO: get version from variable project (CacheLib VERSION 0.1) diff --git a/examples/simple_cache/CMakeLists.txt b/examples/simple_cache/CMakeLists.txt index 64d9dffcbf..4288812f69 100644 --- a/examples/simple_cache/CMakeLists.txt +++ b/examples/simple_cache/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.12...4.0) project (cachelib-cmake-test-project VERSION 0.1) diff --git a/examples/simple_compact_cache/CMakeLists.txt b/examples/simple_compact_cache/CMakeLists.txt index 777fc8e2cd..f39cde16ea 100644 --- a/examples/simple_compact_cache/CMakeLists.txt +++ b/examples/simple_compact_cache/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.12...4.0) project (cachelib-cmake-test-project VERSION 0.1) diff --git a/examples/single_tier_cache/CMakeLists.txt b/examples/single_tier_cache/CMakeLists.txt index d89e0b465e..ab46aa1534 100644 --- a/examples/single_tier_cache/CMakeLists.txt +++ b/examples/single_tier_cache/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.12...4.0) project (cachelib-cmake-test-project VERSION 0.1) From 101d155000b288b5962dd2945dfbd294241c4885 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 23 May 2025 16:27:58 +0200 Subject: [PATCH 2/2] Use GNUInstallDirs defaults --- cachelib/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cachelib/CMakeLists.txt b/cachelib/CMakeLists.txt index 2937660506..5de98958e6 100644 --- a/cachelib/CMakeLists.txt +++ b/cachelib/CMakeLists.txt @@ -44,16 +44,17 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(BUILD_TESTS "If enabled, compile the tests." ON) +include(GNUInstallDirs) -set(BIN_INSTALL_DIR bin CACHE STRING +set(BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "The subdirectory where binaries should be installed") set(TESTS_INSTALL_DIR tests CACHE STRING "The subdirectory where test binaries should be installed") -set(INCLUDE_INSTALL_DIR include/cachelib CACHE STRING +set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/cachelib CACHE STRING "The subdirectory where header files should be installed") -set(LIB_INSTALL_DIR lib CACHE STRING +set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "The subdirectory where libraries should be installed") -set(CMAKE_INSTALL_DIR lib/cmake/cachelib CACHE STRING +set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/cachelib CACHE STRING "The subdirectory where CMake package config files should be installed") set(CONFIGS_INSTALL_DIR test_configs CACHE STRING "The subdirectory where sample test configurations should be installed")