Currently the export(...) cmake directive is scoped inside if (FMT_INSTALL):
|
export( |
|
TARGETS ${INSTALL_TARGETS} |
|
NAMESPACE fmt:: |
|
FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) |
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. Kistler-Group/sdbus-cpp#523
Currently the
export(...)cmake directive is scoped insideif (FMT_INSTALL):fmt/CMakeLists.txt
Lines 496 to 499 in 11ddbcb
However, there are cases in which downstream projects might not want to install
fmtbut might still want to provide aexport(...)themselves. However, this is impossible to do when depending on another target that doesn'texportitself. CMake will error with something likeSince having the exported target files in the build tree don't harm anyone, I suggest just unconditionally exporting regardless of whether
FMT_INSTALLis true or not.See also e.g. Kistler-Group/sdbus-cpp#523