add installation components

CMake can now install specific sub-components when installing.
This gives parent projects and users greater control over which parts of the library to install.
This commit is contained in:
Jordan Williams 2020-01-10 13:14:39 -06:00
parent cd0b3f9695
commit 3533ad9f64
2 changed files with 9 additions and 9 deletions

View File

@ -247,20 +247,20 @@ if (FMT_INSTALL)
# Install version, config and target files. # Install version, config and target files.
install( install(
FILES ${project_config} ${version_config} FILES ${project_config} ${version_config}
DESTINATION ${FMT_CMAKE_DIR}) DESTINATION ${FMT_CMAKE_DIR} COMPONENT FMT_Development)
install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR} install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
NAMESPACE fmt::) NAMESPACE fmt:: COMPONENT FMT_Development)
# Install the library and headers. # Install the library and headers.
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
LIBRARY DESTINATION ${FMT_LIB_DIR} LIBRARY DESTINATION ${FMT_LIB_DIR} COMPONENT FMT_Runtime
ARCHIVE DESTINATION ${FMT_LIB_DIR} ARCHIVE DESTINATION ${FMT_LIB_DIR} COMPONENT FMT_Development
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT FMT_Runtime)
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}> install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}>
DESTINATION ${FMT_LIB_DIR} OPTIONAL) DESTINATION ${FMT_LIB_DIR} OPTIONAL COMPONENT FMT_Development)
install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR} COMPONENT FMT_Development)
install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}") install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}" COMPONENT FMT_Development)
endif () endif ()
if (FMT_DOC) if (FMT_DOC)

View File

@ -9,4 +9,4 @@ add_custom_target(doc
SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html) SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
DESTINATION share/doc/fmt OPTIONAL) DESTINATION share/doc/fmt OPTIONAL COMPONENT FMT_Documentation)