Configuration - Fix BUILD_SOVERSION_NUMBERS=0 handling (#1199)

- Distinguish an explicitly selected 0 from an unset cache value
- Omit VERSION and SOVERSION on non-Windows platforms when versioned library names are disabled
- Preserve Windows DLL version metadata
- Clarify the option description and supported values
This commit is contained in:
Angelo Bartolome
2026-09-04 16:52:07 +01:00
committed by GitHub
parent 4b801ad354
commit 8e05e086fe
4 changed files with 16 additions and 13 deletions
+7 -8
View File
@@ -147,19 +147,18 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
# set soversion variable determining compatibility version on platforms with symlinks
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if (NOT BUILD_SOVERSION_NUMBERS)
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
# set the number of version components in shared library names and SONAME
# 0 - for none, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if ("${BUILD_SOVERSION_NUMBERS}" STREQUAL "")
# update default state of soversion on different platforms
if (WIN32 OR ANDROID OR EMSCRIPTEN)
set (BUILD_SOVERSION_NUMBERS 0)
set (BUILD_SOVERSION_NUMBERS "0")
else()
set (BUILD_SOVERSION_NUMBERS 2)
set (BUILD_SOVERSION_NUMBERS "2")
endif()
endif()
set (BUILD_SOVERSION_NUMBERS "${BUILD_SOVERSION_NUMBERS}" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
set_property (CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
+6 -3
View File
@@ -204,9 +204,12 @@ elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
endif()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
if (BUILD_SOVERSION_NUMBERS GREATER 0 OR WIN32)
set_target_properties (${PROJECT_NAME} PROPERTIES
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
endif()
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
set (USED_EXTERNLIB_AND_TOOLKITS)
+2 -1
View File
@@ -25,7 +25,8 @@ set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries")
set (BUILD_SOVERSION_NUMBERS_DESCR
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
"Number of version components in shared library names and SONAME: 0 - for none,
1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
"Disables exceptions like Standard_OutOfRange in Release builds.
+1 -1
View File
@@ -161,7 +161,7 @@ The following table gives the full list of environment variables used at the con
| BUILD_RELEASE_DISABLE_EXCEPTIONS | Boolean | Disables exceptions like Standard_OutOfRange in Release builds. Defines No_Exception macros for Release builds when enabled (default). These exceptions are always enabled in Debug builds, but disabled in Release for better performance |
| BUILD_RESOURCES | Boolean | Enables regeneration of OCCT resource files |
| BUILD_SHARED_LIBRARY_NAME_POSTFIX | String | Appends the postfix to names of output libraries |
| BUILD_SOVERSION_NUMBERS | String | Version numbers to put into SONAME: 0 for empty, 1 for major, 2 for major.minor, 3 for major.minor.maintenance |
| BUILD_SOVERSION_NUMBERS | String | Number of version components in shared library names and SONAME: 0 for none, 1 for major, 2 for major.minor, 3 for major.minor.maintenance |
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
| USE_MMGR_TYPE | String | Select memory manager (NATIVE, FLEXIBLE, TBB, or JEMALLOC) |
| USE_GIT_HASH | Boolean | Include the git hash in the OCCT version string |