From d4644ae33a096aed259700f5e3e17ece3502f877 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 22:40:43 +0000 Subject: [PATCH] build!: require CMake 3.25 - Raise the minimum from 3.15 to 3.25 and the policy range to 3.31 - Remove the 3.22 version guards for ENVIRONMENT_MODIFICATION - Link the GoogleTest target GTest::gtest, which FindGTest and the GoogleTest package config both provide Co-Authored-By: Claude Sonnet 5.5 --- CMakeLists.txt | 9 +-------- cmake/GTestHelper.cmake | 6 +++--- examples/CMakeLists.txt | 2 +- test/consumer/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 833ba635..21a7e446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ # Project ###################################################################### -cmake_minimum_required(VERSION 3.15...3.30 FATAL_ERROR) +cmake_minimum_required(VERSION 3.25...3.31 FATAL_ERROR) list(PREPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(GitHelper) @@ -44,13 +44,6 @@ include(FairMQDependencies) # Targets ###################################################################### -if(FAIRMQ_TEST_LD_LIBRARY_PATH AND CMAKE_VERSION VERSION_LESS 3.22) - # The per-test injection relies on ctest's ENVIRONMENT_MODIFICATION, which - # older CMake silently drops -- the tests would run against the default - # runtime while looking green. - message(FATAL_ERROR "FAIRMQ_TEST_LD_LIBRARY_PATH requires CMake >= 3.22") -endif() - if(BUILD_FAIRMQ) add_subdirectory(fairmq) endif() diff --git a/cmake/GTestHelper.cmake b/cmake/GTestHelper.cmake index 397e397c..b559a72b 100644 --- a/cmake/GTestHelper.cmake +++ b/cmake/GTestHelper.cmake @@ -61,8 +61,8 @@ function(add_testsuite suitename) ${ARGN} ) - # runner.cxx defines main(), so do not link GTest::Main - list(INSERT testsuite_LINKS 0 GTest::GTest) + # runner.cxx defines main(), so do not link GTest::gtest_main + list(INSERT testsuite_LINKS 0 GTest::gtest) set(target "testsuite_${suitename}") add_executable(${target} ${testsuite_SOURCES}) @@ -79,7 +79,7 @@ function(add_testsuite suitename) if(testsuite_DEFINITIONS) target_compile_definitions("${target}" PUBLIC ${testsuite_DEFINITIONS}) endif() - if(testsuite_ENVIRONMENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22) + if(testsuite_ENVIRONMENT) set(env "ENVIRONMENT_MODIFICATION" ${testsuite_ENVIRONMENT}) endif() if(BUILD_TIDY_TOOL AND RUN_FAIRMQ_TIDY) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 348749ac..c9e11e0b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,7 +15,7 @@ set(transports "zeromq" "shmem") # Environment for every example test (directory scope, so the subdirectories # see it too) set(env_mods) -if(ENABLE_SANITIZER_LEAK AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22) +if(ENABLE_SANITIZER_LEAK) get_filename_component(lsan_supps "${CMAKE_SOURCE_DIR}/test/leak_sanitizer_suppressions.txt" ABSOLUTE) list(APPEND env_mods "LSAN_OPTIONS=set:suppressions=${lsan_supps}") endif() diff --git a/test/consumer/CMakeLists.txt b/test/consumer/CMakeLists.txt index 67038d93..e0ab230a 100644 --- a/test/consumer/CMakeLists.txt +++ b/test/consumer/CMakeLists.txt @@ -9,7 +9,7 @@ # Minimal downstream project. It checks that an installed FairMQ can be found # and used the way the README describes. Run it via check-install.sh. -cmake_minimum_required(VERSION 3.15...3.30 FATAL_ERROR) +cmake_minimum_required(VERSION 3.15...3.31 FATAL_ERROR) project(FairMQConsumer LANGUAGES CXX) find_package(FairCMakeModules REQUIRED)