So I've been meaning to implement a way to recognize TDM builds, so that SFML actually builds correctly and not static for shared & static (yeah I assume the official builds are built wrong as well).
The critical part would involve changing the following lines (Macros.cmake:101):
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
if(NOT SFML_GCC_VERSION VERSION_LESS "4")
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
endif()
endif()
But once I tried to change things around I started to ask myself:
- Why do we not use -static, thus removing the need for the check, listing of both flags and linking everything possible static - which would be what one would expect. For example if the shipped compiler uses pthread for handling threads and one compiles just with -static-libgcc and -static-libstdc++ one will still have to ship the libwinpthread.dll, because it didn't get linked statically. So what's the reason for not using -static?
- If you don't want to change it, would it be okay to pull the VERSION check into the upper if and do a TDM + shared/TDM + static check in an inner if?
Given the occasion of discussing linker stuff, I want to bring the other topic about
properly linking dependencies again to attention. I still feel it should be changed...