From c4ea903250e20c3ffa9b70695c33207dc9b9a0e2 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Fri, 14 Jun 2024 03:17:46 +0800 Subject: [PATCH] Only install `FILE_SET` when needed (#4013) --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6763e7a9fa7e..14ce361a6f73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,13 +403,19 @@ if (FMT_INSTALL) set(INSTALL_TARGETS fmt fmt-header-only) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND CMAKE_GENERATOR STREQUAL "Ninja") + set(INSTALL_FILE_SET FILE_SET fmt DESTINATION "${FMT_INC_DIR}/fmt") + else() + set(INSTALL_FILE_SET) + endif() + # Install the library and headers. install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} LIBRARY DESTINATION ${FMT_LIB_DIR} ARCHIVE DESTINATION ${FMT_LIB_DIR} PUBLIC_HEADER DESTINATION "${FMT_INC_DIR}/fmt" - FILE_SET fmt DESTINATION "${FMT_INC_DIR}/fmt" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ${INSTALL_FILE_SET}) # Use a namespace because CMake provides better diagnostics for namespaced # imported targets.