Skip to content

Configuration - Fix BUILD_SOVERSION_NUMBERS=0 not disabling versioned dylib symlinks#1199

Draft
angelobartolome wants to merge 1 commit intoOpen-Cascade-SAS:masterfrom
angelobartolome:fix/build-soversion-numbers-zero
Draft

Configuration - Fix BUILD_SOVERSION_NUMBERS=0 not disabling versioned dylib symlinks#1199
angelobartolome wants to merge 1 commit intoOpen-Cascade-SAS:masterfrom
angelobartolome:fix/build-soversion-numbers-zero

Conversation

@angelobartolome
Copy link
Copy Markdown

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.

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 waited User need to process with CLA before review or integration processes

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants