#646·mimalloc

cmake target_link_libraries(... ${mi_libraries}) should use PRIVATE ?

Author: thehansCreated Nov 10, 2022Updated Sep 27, 2026
Labelsstale

I noticed that mimalloc's CMakeLists.txt links to system libraries as PUBLIC for both MI_BUILD_SHARED here: https://github.com/microsoft/mimalloc/blob/ba8c0f890314d80d830599f686eaa63aafcee880/CMakeLists.txt#L343 and for MI_BUILD_STATIC here: https://github.com/microsoft/mimalloc/blob/ba8c0f890314d80d830599f686eaa63aafcee880/CMakeLists.txt#L373

As far as I understand the usage of this, it would be more proper to link these as PRIVATE.

I'm wondering if this has some effect on the initialization order of imported dll, as seen in #542 (cross compile issue using cmake and MinGW)

mimalloc-redirect.dll seems to be initialized after ucrtbase.dll