cmake: Add BULLET_BUILD_SHARED_LIBS to replace BUILD_SHARED_LIBS #4536
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When building with MSVC, bullet doesn't support using shared libs.
Projects might choose to build bullet as part of their CMake pipeline, and there's currently no good way to override BUILD_SHARED_LIBS to static just for bullet, and still support shared library outside of bullet.
This change adds an intermediate BULLET_BUILD_SHARED_LIBS that caches the initial value of BUILD_SHARED_LIBS, but can be freely overriden by parent projects. In my case, I want to be able to force bullet to static on windows, since the original developer didn't support this use case.
All calls to add_library() now have an explicit BULLET_BUILD_TYPE to this purpose. Previous call to add_library() that already were overriding the default build type were left alone. This should be enough to support all current use cases and add the ability for parent projects to force bullet to static.