Indeed, /wholearchive exists on windows and can be used with the referenced cmake version, but unfortunately:
- ensuring certain symbols are not discarded - others are (-gc-sections), - it works reliably - for all platforms that qt supports is more involved. See QTBUG-97816 , the comments there, and also linked issues and their comments. At some point we'll have to revisit if it's perhaps more feasible to do now, or limit it to specific platforms and newer cmake versions. > On 23. Jan 2023, at 12:11, Cristian Adam via Interest > <interest@qt-project.org> wrote: > > >> Yes, there is. There's -Wl,--whole-archive for the Unix linkers. This > should > >> solve the problem for everyone except MSVC users. > > > That option is not very attractive because: > > > a, as you state yourself, it doesn't work on MSVC. > > MSVC also has a /wholearchive parameter to the linker. > > Starting with CMake 3.24 you can use it generically as: > > target_link_libraries(my_exe PRIVATE > "$<LINK_LIBRARY:WHOLE_ARCHIVE,my_static_lib>") > > Fore more details see: > • > https://cmake.org/cmake/help/latest/variable/CMAKE_LINK_LIBRARY_USING_FEATURE.html > • > https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:LINK_LIBRARY > > Cheers, > Cristian. > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest