Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed fix for issue #1264 #1534

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ set_target_properties(fmt PROPERTIES
VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
DEBUG_POSTFIX d)

# Configure pkg-config fmt.pc properly
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
ambitslix marked this conversation as resolved.
Show resolved Hide resolved
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
get_target_property(_FMT_LIB_POSTFIX ${PROJECT_NAME_LOWER} DEBUG_POSTFIX)
set(FMT_LIB_NAME ${PROJECT_NAME_LOWER}${_FMT_LIB_POSTFIX})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest defining FMT_DEBUG_POSTFIX and using it here and to set target postfix in line 177 above instead of getting it from the properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like so?

set(FMT_DEBUG_POSTFIX d)

set_target_properties(fmt PROPERTIES
  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()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. This simplifies the logic a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed.

else()
set(FMT_LIB_NAME ${PROJECT_NAME_LOWER})
endif()

if (BUILD_SHARED_LIBS)
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
# Fix rpmlint warning:
Expand Down
2 changes: 1 addition & 1 deletion support/cmake/fmt.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}