Skip to content

COMP: Suppress macOS linker warnings for duplicate -lm from ITK dependencies - #1376

Merged
jamesobutler merged 1 commit into
commontk:masterfrom
BRAINSia:pr/itk-linker-warnings
Mar 28, 2026
Merged

COMP: Suppress macOS linker warnings for duplicate -lm from ITK dependencies#1376
jamesobutler merged 1 commit into
commontk:masterfrom
BRAINSia:pr/itk-linker-warnings

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #1372, part of a systematic clazy static analysis effort to improve CTK for Slicer compatibility and Qt6 migration.

What this changes

Adds CMake logic to detect and deduplicate -lm linker flags injected by ITK on macOS, eliminating spurious ld: warning: duplicate -lm messages during CTK builds that link ITK.

Why

Pre-existing macOS-specific linker noise from ITK dependency flags. These warnings appear on every build and obscure real issues in build output.

Testing

  • Builds cleanly with zero new compiler warnings
  • Existing tests pass (no regressions)

🤖 Identified via clazy static analysis using CTK-claude-skills

@hjmjohnson hjmjohnson changed the title COMP COMP: Suppress macOS linker warnings for duplicate -lm from ITK dependencies Mar 24, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review March 26, 2026 13:34
…dencies

On macOS, Apple's linker warns about duplicate -lm entries that arise from
ITK's transitive dependency chains. The duplicates are harmless (the linker
deduplicates them) but produce ~70 warnings per build. Suppress them at the
linker level in both the ITK ExternalProject and CTK's own targets since the
fix belongs upstream in ITK's exported targets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jamesobutler
jamesobutler force-pushed the pr/itk-linker-warnings branch from 138477b to 36069a5 Compare March 28, 2026 14:13
@jamesobutler
jamesobutler enabled auto-merge (rebase) March 28, 2026 14:14
@jamesobutler
jamesobutler merged commit 7f74518 into commontk:master Mar 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants