Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Vanilla SFML 3 Compilation: No BUILD_SHARED_LIBS Option in CMake  (Read 621 times)

0 Members and 1 Guest are viewing this topic.

Grundkurs

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Vanilla SFML 3 Compilation: No BUILD_SHARED_LIBS Option in CMake
« on: February 15, 2025, 09:27:49 am »
I just tried compiling SFML 3 on windows 11 using
- MinGW-W64 x86_64-ucrt-posix-seh 14.2.0
- cmake version 3.31.5

I ended up creating files such as
libsfml-audio-s-d.a
libsfml-audio-s.a
etc.
I guess these are static libraries? Usually shared libs have been build in the "default setting" when you don't touch anything in CMake.

The tutorial here
https://www.sfml-dev.org/tutorials/3.0/getting-started/build-from-source/#configuring-your-sfml-build
states, that CMake provides a boolean Option BUILD_SHARED_LIBS. But its nowhere displayed in cmake-gui:
How can i build the shared libs using cmake-gui? Am i out of luck?



EDIT: There is a small Button "Add Entry" in Cmake-GUI, which let me add BUILD_SHARED_LIBS to the configuration. But i think it still should be there by default? Compiling SFML with that Option enabled created the right files (sfml-graphics-d-3.dll etc.)
« Last Edit: February 15, 2025, 09:45:29 am by Grundkurs »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11145
    • View Profile
    • development blog
    • Email
Re: Vanilla SFML 3 Compilation: No BUILD_SHARED_LIBS Option in CMake
« Reply #1 on: February 15, 2025, 04:01:33 pm »
Usually shared libs have been build in the "default setting" when you don't touch anything in CMake.
It's not. The default behavior is building static libs, but SFML has previously always changed the default to build shared libs. For SFML 3 we gone back to the CMake default behavior, giving you static libs if you don't set BUILD_SHARED_LIBS.

that CMake provides a boolean Option BUILD_SHARED_LIBS. But its nowhere displayed in cmake-gui
I'll check with Thrasher if we should add the cache option for convenience.

EDIT: There is a small Button "Add Entry" in Cmake-GUI, which let me add BUILD_SHARED_LIBS to the configuration.
That's correct
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Thrasher

  • SFML Team
  • Jr. Member
  • *****
  • Posts: 62
    • View Profile
Re: Vanilla SFML 3 Compilation: No BUILD_SHARED_LIBS Option in CMake
« Reply #2 on: February 15, 2025, 04:10:38 pm »
It's normal to omit referring to BUILD_SHARED_LIBS in CMake scripts. I'd wager most projects don't touch this variable. It defaults to static libraries which I think is the more sensible default value anyways. I don't think SFML needs to add it as a cache variable. Users can add it to their cache if they wish. I actually do this sometimes myself. It's not a typical use case to want to flip/flop between shared and static libraries on a regular basis. Developers like myself sometimes need that for the sake of testing but the typical user won't be doing that.

 

anything