microsoft / microsoft/mimalloc

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

Open
#646 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.4k
Forks
1.2k
Avg merge
4d 45m
Merged PRs (30d)
13

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in CMakeLists.txt at the MI_BUILD_SHARED and MI_BUILD_STATIC target_link_libraries calls referenced in the issue. Review CMake's PUBLIC versus PRIVATE propagation and compare the behavior with the initialization-order concern in issue #542; done means confirming the appropriate visibility and its effect on the reported MinGW case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.