Skip to content

Configuration - Fix BUILD_SOVERSION_NUMBERS=0 handling - #1199

Merged
dpasukhi merged 3 commits into
Open-Cascade-SAS:IRfrom
angelobartolome:fix/build-soversion-numbers-zero
Sep 4, 2026
Merged

dpasukhi merged 3 commits into
Open-Cascade-SAS:IRfrom
angelobartolome:fix/build-soversion-numbers-zero

Conversation

@angelobartolome

@angelobartolome angelobartolome commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Setting -DBUILD_SOVERSION_NUMBERS=0 had no effect on macOS (and other non-Windows/Android/Emscripten platforms) due to two bugs:

  • CMakeLists.txt: The guard condition if (NOT BUILD_SOVERSION_NUMBERS) evaluates to true when the value is 0, because CMake treats 0 as falsy. This silently overrode the user's explicit 0 back to 2 on every cmake run. Fixed by using NOT DEFINED ... OR STREQUAL "" to only apply the platform default when the variable is genuinely absent from the cache.

  • adm/cmake/occt_toolkit.cmake: The VERSION target property was set unconditionally regardless of BUILD_SOVERSION_NUMBERS. On macOS, setting VERSION alone is sufficient for CMake to generate versioned filenames (e.g. libTKBin.7.9.2.dylib) and symlinks, even with SOVERSION cleared. Fixed by making VERSION conditional on BUILD_SOVERSION_NUMBERS > 0.

Test plan

  • Configure with -DBUILD_SOVERSION_NUMBERS=0 and verify only unversioned .dylib files are produced (no libTK*.7*.dylib variants)
  • Configure with -DBUILD_SOVERSION_NUMBERS=2 (default on macOS/Linux) and verify versioned symlinks are still generated as before
  • Verify Windows/Android/Emscripten default of 0 is still applied when the variable is not explicitly set

🤖 Generated with Claude Code

… dylib symlinks

Two issues prevented BUILD_SOVERSION_NUMBERS=0 from working:

1. CMakeLists.txt used `if (NOT BUILD_SOVERSION_NUMBERS)` which evaluates
   true when the value is 0 (CMake treats 0 as falsy), silently overriding
   the user's setting back to 2 on non-Windows platforms. Fixed by using
   `NOT DEFINED` / `STREQUAL ""` to only apply the default when the variable
   is genuinely absent from the cache.

2. adm/cmake/occt_toolkit.cmake set the VERSION target property
   unconditionally, so even with SOVERSION cleared, CMake still generated
   versioned filenames (e.g. libTKBin.7.9.2.dylib). Fixed by making VERSION
   conditional on BUILD_SOVERSION_NUMBERS > 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@angelobartolome
angelobartolome marked this pull request as draft April 10, 2026 16:58
@dpasukhi dpasukhi added 1. Configuration CMake/QMake processes of OCCT or samples 3. CLA waited User need to process with CLA before review or integration processes labels Apr 10, 2026
@dpasukhi

Copy link
Copy Markdown
Member

Dear @angelobartolome

Thank you for your patch. To proceed with integration, please complete signing CLA process:
The links: Contribution Guide
Or https://dev.opencascade.org/get_involved

In case if you already have signed CLA, please share ID that OCCT team shared with your by email after accepting of CLA.

@angelobartolome

Copy link
Copy Markdown
Contributor Author

@dpasukhi do you accept digitally signed CLA? (PDF) or does it needs to be actually printed and hand-signed?

@dpasukhi

dpasukhi commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Yes, it is possible to be digital (most people do that).

@dpasukhi dpasukhi added 3. CLA approved User has the signed CLA and ready to review or integration processes and removed 3. CLA waited User need to process with CLA before review or integration processes labels Jun 4, 2026
@angelobartolome
angelobartolome marked this pull request as ready for review June 4, 2026 20:32
@dpasukhi
dpasukhi changed the base branch from master to IR September 4, 2026 14:10
@dpasukhi dpasukhi changed the title Configuration - Fix BUILD_SOVERSION_NUMBERS=0 not disabling versioned dylib symlinks Configuration - Fix BUILD_SOVERSION_NUMBERS=0 handling Sep 4, 2026
@dpasukhi
dpasukhi self-requested a review September 4, 2026 14:28
@github-project-automation github-project-automation Bot moved this from Todo to Integration in Maintenance Sep 4, 2026
- preserve contributor commits and PR ancestry
- retain CMake 3.10 compatibility and Windows image version metadata
- normalize the cache entry and clarify option documentation
@dpasukhi
dpasukhi force-pushed the fix/build-soversion-numbers-zero branch from fc866f9 to fe8a271 Compare September 4, 2026 14:34
@dpasukhi
dpasukhi merged commit 8e05e08 into Open-Cascade-SAS:IR Sep 4, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from Integration to Done in Maintenance Sep 4, 2026
@dpasukhi

dpasukhi commented Sep 4, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Configuration CMake/QMake processes of OCCT or samples 3. CLA approved User has the signed CLA and ready to review or integration processes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants