From 5971a258407f8e45b6295c70d406a0fd2b93c249 Mon Sep 17 00:00:00 2001 From: Dan Ibanez Date: Fri, 29 Jan 2021 09:26:05 -0700 Subject: [PATCH] Fix ordering of install commands for CMake the library itself needs to be installed before the fmt-targets.cmake file is installed, otherwise the installed targets file doesn't actually point to the library using IMPORTED_LOCATION --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f21cf456..470940f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,6 +294,13 @@ if (FMT_INSTALL) INSTALL_DESTINATION ${FMT_CMAKE_DIR}) set(INSTALL_TARGETS fmt fmt-header-only) + + # Install the library and headers. + install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} + LIBRARY DESTINATION ${FMT_LIB_DIR} + ARCHIVE DESTINATION ${FMT_LIB_DIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + # Use a namespace because CMake provides better diagnostics for namespaced # imported targets. export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt:: @@ -306,12 +313,6 @@ if (FMT_INSTALL) install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR} NAMESPACE fmt::) - # Install the library and headers. - install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} - LIBRARY DESTINATION ${FMT_LIB_DIR} - ARCHIVE DESTINATION ${FMT_LIB_DIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(FILES $ DESTINATION ${FMT_LIB_DIR} OPTIONAL) install(FILES ${FMT_HEADERS} DESTINATION "${FMT_INC_DIR}/fmt")