libsdl-org/SDL_image

BUILD_SHARED_LIBS is set to ON by default

eliasdaler opened this issue · 2 comments

Hello.
I've noticed that BUILD_SHARED_LIBS gets set as ON by SDL_image's CMakeLists.txt and this is rather annoying, because it's set as OFF by CMake by default - now I need to explicitly set BUILD_SHARED_LIBS myself if I want to statically link - none of the other 3rd party libs required me to do so.

What do you think about removing the following line?
https://github.com/libsdl-org/SDL_image/blob/release-2.6.3/CMakeLists.txt#L47

We strongly advise users to link to shared SDL libraries so it is easy to upgrade the SDL library without rebuilding the main application. This is useful for applications that are closed source. This default allows us to nudge users in this direction.

We know building a shared library by default is not standard CMake behavior. But its documentation does not stipulate a default value so we're not violating any contract.

FYI, just yesterday we've changed the main CMake script to not build the static library by default.

Sorry for the annoyance, but as you've written it can be changed easily using the BUILD_SHARED_LIBS variable. You need to set that variable anyways to be 100% certain about sharedness of you dependencies.

Fair enough.
Closing :)