[cmake] fix MASTER_PROJECT heuristic; only enable install if root#4536
Merged
vitaut merged 1 commit intofmtlib:masterfrom Sep 10, 2025
crueter:patch-1
Merged
[cmake] fix MASTER_PROJECT heuristic; only enable install if root#4536vitaut merged 1 commit intofmtlib:masterfrom crueter:patch-1
MASTER_PROJECT heuristic; only enable install if root#4536vitaut merged 1 commit intofmtlib:masterfrom
crueter:patch-1
Conversation
…roject SOURCE vs CURRENT_SOURCE is unreliable. `DEFINED PROJECT_NAME` is a much more portable way of determination. Also, installation shouldn't default to on if it is a subproject.
MASTER_PROJECT heuristic; only enable install if root
Contributor
|
Thanks for the PR but could you elaborate why the current check is unreliable? |
Contributor
Author
With CPM.cmake and I believe FetchContent, FMT_MASTER_PROJECT would always evaluate to ON since those set CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR for this subdirectory. I remember there being some good reason for this but I can't recall exactly what it is; regardless, with this change, FMT_MASTER_PROJECT now works in all scenarios I tried: CPM, FetchContent, Git submodules, and as a standalone project. |
Contributor
|
Merged, thanks! |
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Sep 30, 2025
`fmtlib` version was updated to 12.0.0 in #163441. In this new version, due to fmtlib/fmt#4536, PyTorch started not installing `fmtlib` headers anymore. Because of that, PyTorch/XLA build CI started to fail pytorch/xla#9653. While we did fix it internally pytorch/xla#9650, I believe that PyTorch should continue installing the `fmtlib` headers, since it is a dependency of its C API [`python_arg_parser.h`][1]. PyTorch/XLA CI was moved to `unstable.yml` in #159272, and later removed in #163564. This PyTorch/XLA build failure went under the radar, since the `fmtlib` update only landed on September 22. [1]: https://github.com/pytorch/pytorch/blob/84d673ef577d42d6ec20c6c9f09863583c3111f5/torch/csrc/utils/python_arg_parser.h#L42 Pull Request resolved: #164139 Approved by: https://github.com/Skylion007, https://github.com/malfet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SOURCE vs CURRENT_SOURCE is unreliable.
DEFINED PROJECT_NAMEis a much more portable way of determination.Also, installation shouldn't default to on if it is a subproject.