definelicht · GitHub

Previously, transitively inherited calls to
`target_include_directories(foo SYSTEM ...)` were being squashed into a
flat list of includes, effectively stripping off `-isystem` and
unintentionally forwarding warnings from such dependencies.
To correctly propagate `SYSTEM` dependencies, use
`target_link_libraries` to forward the parent target's link dependencies
to the OBJECT library (similar to the `_static` flow below). Unlike a
flat `target_include_directories`, this lets CMake resolve transitive
SYSTEM include directories through the proper dependency chain.
Note that `target_link_libraries` on an OBJECT library propagates all
usage requirements, not just includes. This also brings in transitive
`INTERFACE_COMPILE_DEFINITIONS`, `INTERFACE_COMPILE_OPTIONS`, and
`INTERFACE_COMPILE_FEATURES`. This is arguably more correct, as the
OBJECT library compiles the same sources and should see the same flags.
The existing `target_include_directories` call is retained for include
directories set directly on the target (not through link dependencies).
CMake deduplicates include directories that appear through both paths.
Compile definitions and options may technically appear twice (once via
the OBJECT library, once via the consuming target), but duplicate `-D`
and flag entries are harmless in practice.
Also fix `clang_target_link_libraries` and `mlir_target_link_libraries`
to forward the link type (PUBLIC/PRIVATE/INTERFACE) to `obj.*` targets.
Previously the type keyword was silently dropped, resulting in plain-
signature `target_link_libraries` calls. This is now required because
the new keyword-signature call in `llvm_add_library` would otherwise
conflict (CMake requires all calls on a target to use the same
signature).

@definelicht

@definelicht

@definelicht

petrhosek

@definelicht

@definelicht

nextsilicon-itay-bookstein added a commit to nextsilicon/llvm-project that referenced this pull request

Feb 28, 2026
Fix-forward for llvm#183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

Merged

nextsilicon-itay-bookstein added a commit that referenced this pull request

Feb 28, 2026
Fix-forward for #183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request

Feb 28, 2026
…(#183889)
Fix-forward for llvm/llvm-project#183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

gulfemsavrun added a commit to gulfemsavrun/llvm-project that referenced this pull request

Mar 2, 2026

Merged

gulfemsavrun added a commit that referenced this pull request

Mar 2, 2026
#184186)
…83889)"
This reverts commit  2342db0 .
Revert "[CMake] Propagate dependencies to OBJECT libraries in
`add_llvm_library` (#183541)"
This reverts commit  e3c0454 .

sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request

Mar 4, 2026
…ry` (llvm#183541)
Previously, transitively inherited calls to
`target_include_directories(foo SYSTEM ...)` were being squashed into a
flat list of includes, effectively stripping off `-isystem` and
unintentionally forwarding warnings from such dependencies.
To correctly propagate `SYSTEM` dependencies, use
`target_link_libraries` to forward the parent target's link dependencies
to the OBJECT library (similar to the `_static` flow below). Unlike a
flat `target_include_directories`, this lets CMake resolve transitive
SYSTEM include directories through the proper dependency chain.
Note that `target_link_libraries` on an OBJECT library propagates all
usage requirements, not just includes. This also brings in transitive
`INTERFACE_COMPILE_DEFINITIONS`, `INTERFACE_COMPILE_OPTIONS`, and
`INTERFACE_COMPILE_FEATURES`. This is arguably more correct, as the
OBJECT library compiles the same sources and should see the same flags.
The existing `target_include_directories` call is retained for include
directories set directly on the target (not through link dependencies).
CMake deduplicates include directories that appear through both paths.
Compile definitions and options may technically appear twice (once via
the OBJECT library, once via the consuming target), but duplicate `-D`
and flag entries should be harmless in practice.
Also fix `clang_target_link_libraries` and `mlir_target_link_libraries`
to forward the link type (PUBLIC/PRIVATE/INTERFACE) to `obj.*` targets.
Previously the type keyword was silently dropped, resulting in
plain-signature `target_link_libraries` calls. This is now required
because the new keyword-signature call in `llvm_add_library` would
otherwise conflict (CMake requires all calls on a target to use the same
signature).

sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request

Mar 4, 2026
Fix-forward for llvm#183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request

Mar 4, 2026

sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request

Mar 5, 2026
…ry` (llvm#183541)
Previously, transitively inherited calls to
`target_include_directories(foo SYSTEM ...)` were being squashed into a
flat list of includes, effectively stripping off `-isystem` and
unintentionally forwarding warnings from such dependencies.
To correctly propagate `SYSTEM` dependencies, use
`target_link_libraries` to forward the parent target's link dependencies
to the OBJECT library (similar to the `_static` flow below). Unlike a
flat `target_include_directories`, this lets CMake resolve transitive
SYSTEM include directories through the proper dependency chain.
Note that `target_link_libraries` on an OBJECT library propagates all
usage requirements, not just includes. This also brings in transitive
`INTERFACE_COMPILE_DEFINITIONS`, `INTERFACE_COMPILE_OPTIONS`, and
`INTERFACE_COMPILE_FEATURES`. This is arguably more correct, as the
OBJECT library compiles the same sources and should see the same flags.
The existing `target_include_directories` call is retained for include
directories set directly on the target (not through link dependencies).
CMake deduplicates include directories that appear through both paths.
Compile definitions and options may technically appear twice (once via
the OBJECT library, once via the consuming target), but duplicate `-D`
and flag entries should be harmless in practice.
Also fix `clang_target_link_libraries` and `mlir_target_link_libraries`
to forward the link type (PUBLIC/PRIVATE/INTERFACE) to `obj.*` targets.
Previously the type keyword was silently dropped, resulting in
plain-signature `target_link_libraries` calls. This is now required
because the new keyword-signature call in `llvm_add_library` would
otherwise conflict (CMake requires all calls on a target to use the same
signature).

sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request

Mar 5, 2026
Fix-forward for llvm#183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request

Mar 5, 2026

This was referenced

Apr 15, 2026

Closed

Closed

markrvmurray pushed a commit to markrvmurray/llvm-mc6809 that referenced this pull request

Jun 14, 2026
Fix-forward for llvm/llvm-project#183541.
Two callsites to target_link_libraries were not migrated to the
keyword signature.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>

Read the original on github.com ↗