diff --git a/CMakeLists.txt b/CMakeLists.txt index af18a4a16f2..df09be9d27e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,10 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -cmake_minimum_required(VERSION 3.23 FATAL_ERROR) +# 3.27 for $, which O2PhysicsAddWorkflow.cmake uses to give a +# workflow the precompiled header carrier's compile usage requirements without +# also putting it on the link line. Builds use CMake 4.1 (alidist cmake.sh). +cmake_minimum_required(VERSION 3.27 FATAL_ERROR) project(O2Physics VERSION 0.0.1 diff --git a/cmake/O2PhysicsAddWorkflow.cmake b/cmake/O2PhysicsAddWorkflow.cmake index 81877088a95..6b8c46ef0da 100644 --- a/cmake/O2PhysicsAddWorkflow.cmake +++ b/cmake/O2PhysicsAddWorkflow.cmake @@ -69,11 +69,25 @@ function(o2physics_add_dpl_workflow baseTargetName) # cmake_pch.hxx.gch: not used because `RANS_ENABLE_JSON' not defined # The carrier links O2Physics::AnalysisCore, which reaches O2::rANS and its # INTERFACE -DRANS_ENABLE_JSON, while a workflow that links only - # O2::Framework (the converters, the tutorials) never sees it. Hand every - # consumer the carrier's definitions so the two agree. Definitions only -- - # this must not add link dependencies to targets that do not want them. - target_compile_definitions(${targetExeName} PRIVATE - $) + # O2::Framework (the converters, the tutorials) never sees it. + # + # Copying COMPILE_DEFINITIONS fixed that case and revealed another: CI then + # failed on `_REENTRANT' not defined, on a compile line that DID carry + # -DRANS_ENABLE_JSON -- so the copy was working and simply does not reach + # far enough. Whatever supplies _REENTRANT arrives at the carrier as + # something other than a compile definition (-pthread, which travels in + # INTERFACE_COMPILE_OPTIONS, is the likely route), so adding options alone + # would only move the goalposts to whichever kind of usage requirement goes + # missing next. + # + # $ applies a target's *compile* usage requirements -- + # definitions, options, include directories, features -- without placing it + # on the link line or creating a link dependency, which is the constraint + # that ruled out simply linking the carrier. It transfers the whole + # preprocessor state the carrier compiled with, and that state is exactly + # what GCC compares, rather than one property of it at a time. + # Requires CMake >= 3.27. + target_link_libraries(${targetExeName} PRIVATE $) target_precompile_headers(${targetExeName} REUSE_FROM ${_pch}) endif()