>> 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<https://learn.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-170>
 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

Reply via email to