Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<COMPILE_ONLY:>, 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
Expand Down
24 changes: 19 additions & 5 deletions cmake/O2PhysicsAddWorkflow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_PROPERTY:${_pch},COMPILE_DEFINITIONS>)
# 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.
#
# $<COMPILE_ONLY:> 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 $<COMPILE_ONLY:${_pch}>)
target_precompile_headers(${targetExeName} REUSE_FROM ${_pch})
endif()

Expand Down
Loading