diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b4ec0a79227..84db4c848ea5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,10 +173,20 @@ target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES}) target_include_directories(fmt PUBLIC $ $) + +set(FMT_DEBUG_POSTFIX d) set_target_properties(fmt PROPERTIES - VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR} - DEBUG_POSTFIX d) + OUTPUT_NAME fmt + VERSION ${FMT_VERSION} + SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR} + DEBUG_POSTFIX ${FMT_DEBUG_POSTFIX}) + +# Configure pkg-config fmt.pc properly +get_target_property(FMT_LIB_NAME fmt OUTPUT_NAME) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(FMT_LIB_NAME ${FMT_LIB_NAME}${FMT_DEBUG_POSTFIX}) +endif() if (BUILD_SHARED_LIBS) if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") diff --git a/support/cmake/fmt.pc.in b/support/cmake/fmt.pc.in index e935dc78e118..4e030afdf52a 100644 --- a/support/cmake/fmt.pc.in +++ b/support/cmake/fmt.pc.in @@ -6,6 +6,6 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ Name: fmt Description: A modern formatting library Version: @FMT_VERSION@ -Libs: -L${libdir} -lfmt +Libs: -L${libdir} -l@FMT_LIB_NAME@ Cflags: -I${includedir}