@@ -69,11 +69,25 @@ function(o2physics_add_dpl_workflow baseTargetName)
6969 # cmake_pch.hxx.gch: not used because `RANS_ENABLE_JSON' not defined
7070 # The carrier links O2Physics::AnalysisCore, which reaches O2::rANS and its
7171 # INTERFACE -DRANS_ENABLE_JSON, while a workflow that links only
72- # O2::Framework (the converters, the tutorials) never sees it. Hand every
73- # consumer the carrier's definitions so the two agree. Definitions only --
74- # this must not add link dependencies to targets that do not want them.
75- target_compile_definitions (${targetExeName} PRIVATE
76- $<TARGET_PROPERTY :${_pch} ,COMPILE_DEFINITIONS >)
72+ # O2::Framework (the converters, the tutorials) never sees it.
73+ #
74+ # Copying COMPILE_DEFINITIONS fixed that case and revealed another: CI then
75+ # failed on `_REENTRANT' not defined, on a compile line that DID carry
76+ # -DRANS_ENABLE_JSON -- so the copy was working and simply does not reach
77+ # far enough. Whatever supplies _REENTRANT arrives at the carrier as
78+ # something other than a compile definition (-pthread, which travels in
79+ # INTERFACE_COMPILE_OPTIONS, is the likely route), so adding options alone
80+ # would only move the goalposts to whichever kind of usage requirement goes
81+ # missing next.
82+ #
83+ # $<COMPILE_ONLY:> applies a target's *compile* usage requirements --
84+ # definitions, options, include directories, features -- without placing it
85+ # on the link line or creating a link dependency, which is the constraint
86+ # that ruled out simply linking the carrier. It transfers the whole
87+ # preprocessor state the carrier compiled with, and that state is exactly
88+ # what GCC compares, rather than one property of it at a time.
89+ # Requires CMake >= 3.27.
90+ target_link_libraries (${targetExeName} PRIVATE $<COMPILE_ONLY :${_pch} >)
7791 target_precompile_headers (${targetExeName} REUSE_FROM ${_pch} )
7892 endif ()
7993
0 commit comments