Skip to content

Conversation

@pbnf
Copy link

@pbnf pbnf commented Aug 21, 2025

This pull request updates the build configuration in CMakeLists.txt to provide more flexible and explicit control over whether the sick_safetyscanners_base library is built as a shared or static library. The changes improve compatibility with different build systems and make it easier for downstream projects to select the desired library type.

Build configuration improvements:

  • Added a new option SICK_SAFETYSCANNERS_BASE_BUILD_SHARED_LIBS to allow explicit control over building sick_safetyscanners_base as a shared or static library, with sensible defaults based on BUILD_SHARED_LIBS for backward compatibility.
  • Updated the library declaration to conditionally build either a shared or static library based on the resolved option, and set POSITION_INDEPENDENT_CODE for static builds to ensure compatibility.

…ed/static

Changes:

Introduce SICK_SAFETYSCANNERS_BASE_BUILD_SHARED_LIBS option (ON = shared, OFF = static).
Default derives from BUILD_SHARED_LIBS to preserve backward compatibility.

Resolve library type via internal _sick_build_shared and avoid forcing cache writes.
Make FetchContent usage deterministic (parent can set option before FetchContent_MakeAvailable to reliably select static builds).
@chriseichmann
Copy link
Collaborator

Thank you for the contribution!
This seems like a useful addition. I will have a more thorough like at this soon (and update the documentation).

Best,
Chris

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.

2 participants