fmtlib/fmt

`export(` should not be scoped by `FMT_INSTALL`

Open

#4.806 geöffnet am 14. Juni 2026

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C++ (2.881 Forks)batch import
help wanted

Repository-Metriken

Stars
 (23.489 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 2T 9h) (12 gemergte PRs in 30 T)

Beschreibung

Currently the export(...) cmake directive is scoped inside if (FMT_INSTALL): https://github.com/fmtlib/fmt/blob/11ddbcb7898d2d3445d431a54814367b21dee6ad/CMakeLists.txt#L496-L499

However, there are cases in which downstream projects might not want to install fmt but might still want to provide a export(...) themselves. However, this is impossible to do when depending on another target that doesn't export itself. CMake will error with something like

CMake Error: export("MyLibTargets" ...) includes target "mylib" which requires target "fmt" that is not in any export set.

Since having the exported target files in the build tree don't harm anyone, I suggest just unconditionally exporting regardless of whether FMT_INSTALL is true or not.

See also e.g. https://github.com/Kistler-Group/sdbus-cpp/pull/523

Contributor Guide