Skip to content

Fix common depending on configuration in CMake targets - #537

Merged
rolandreichweinbmw merged 1 commit into
eclipse-openbsw:mainfrom
esrlabs:cr-1214460
Aug 11, 2026
Merged

Fix common depending on configuration in CMake targets#537
rolandreichweinbmw merged 1 commit into
eclipse-openbsw:mainfrom
esrlabs:cr-1214460

Conversation

@matthiaskessler

Copy link
Copy Markdown
Contributor

Fix common depending on configuration in CMake targets

"common" is a foundational, header-only interface used by dozens of
libraries, while "configuration" is executable-specific. "common"
had ended up linking "configuration" directly, inverting the
intended dependency direction and forcing every consumer of
"common" to transitively depend on an application's configuration.

  • Remove the leftover duplicate "commonImpl" target from
    executables/referenceApp/configuration/CMakeLists.txt; its source
    file was already compiled into "configuration" and nothing linked
    against it.
  • Restore libs/bsw/common as a pure INTERFACE library (include dirs,
    etl, platform) with no reference to "configuration".
  • Have "configuration" (referenceApp and unitTest variants) link
    PUBLIC "common", the correct direction.
  • common::busid::BusIdTraits::getName() is declared in "common" but
    implemented in each executable's "configuration" library.
    libs/bsw/transport and platforms/s32k1xx/bsp/canflex2Transceiver
    call it directly, so link "configuration" PUBLIC from those
    targets themselves, matching the existing precedent in
    libs/bsw/uds. Reorder link lists so "configuration" appears after
    "transport", since static libraries are resolved left to right.

Add a "module + moduleImpl" section to
doc/dev/guidelines/module.rst describing this pattern: keep the
generic interface target free of implementation-specific
dependencies, and put those in a separate impl target instead.

@rolandreichweinbmw rolandreichweinbmw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just rebase to resolve the documentation merge conflict.

"common" is a foundational, header-only interface used by dozens of
libraries, while "configuration" is executable-specific. "common"
had ended up linking "configuration" directly, inverting the
intended dependency direction and forcing every consumer of
"common" to transitively depend on an application's configuration.

- Remove the leftover duplicate "commonImpl" target from
  executables/referenceApp/configuration/CMakeLists.txt; its source
  file was already compiled into "configuration" and nothing linked
  against it.
- Restore libs/bsw/common as a pure INTERFACE library (include dirs,
  etl, platform) with no reference to "configuration".
- Have "configuration" (referenceApp and unitTest variants) link
  PUBLIC "common", the correct direction.
- common::busid::BusIdTraits::getName() is declared in "common" but
  implemented in each executable's "configuration" library.
  libs/bsw/transport and platforms/s32k1xx/bsp/canflex2Transceiver
  call it directly, so link "configuration" PUBLIC from those
  targets themselves, matching the existing precedent in
  libs/bsw/uds. Reorder link lists so "configuration" appears after
  "transport", since static libraries are resolved left to right.

Add a "module + moduleImpl" section to
doc/dev/guidelines/module.rst describing this pattern: keep the
generic interface target free of implementation-specific
dependencies, and put those in a separate impl target instead.
@rolandreichweinbmw
rolandreichweinbmw merged commit dbd6e11 into eclipse-openbsw:main Aug 11, 2026
257 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants