Enable real dynamic linking by default#25930
Conversation
655b473 to
e01726b
Compare
6e4f78f to
3b0addc
Compare
9fcb66c to
3b9f050
Compare
This change essentially disables `FAKE_DYLIBS` by default, which in turn means `-shared` will now produce dynamic libraries by default. If you want the old behaviour you now need `-sFAKE_DYLIBS`.
| set(CMAKE_SYSTEM_VERSION 1) | ||
|
|
||
| set(CMAKE_CROSSCOMPILING TRUE) | ||
| set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) |
There was a problem hiding this comment.
@bradking, sorry to bother you again, but I'm having trouble landing this change because it seems like it interacts badly with the Modules/Platform/Emscripten-Clang.cmake that now exists upstream.
Even if I set set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") I cannot seems to override the setting here:
Basically it seems like the builtin support is somehow kicking in even though I don't want it. Is there some way I can disable the builtin stuff in using the this file?
It looks like there is some attempt to prevent the bad interaction here: https://github.com/Kitware/CMake/blob/61510710b12ddff97c2c22e146cdfb399daa2dad/Modules/Platform/Emscripten.cmake#L8-L12.
But that doesn't seem to stop the Emscripten-Clang.cmake from having its effects.
There was a problem hiding this comment.
CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS isn't meant to be set by toolchain files. CMake needs to be taught that the Emscripten compiler now supports the -shared flag. What will its CMAKE_C_COMPILER_VERSION be?
There was a problem hiding this comment.
Ah, I see you started discussion in the CMake issue at https://gitlab.kitware.com/cmake/cmake/-/work_items/27240#note_1813569. Let's take the conversation there.
This change essentially disables
FAKE_DYLIBSby default, which inturn means
-sharedwill now produce dynamic libraries by default.If you want the old behaviour you now need
-sFAKE_DYLIBS.