Skip to content

Commit

Permalink
Set PDB path for Visual Studio (#3702)
Browse files Browse the repository at this point in the history
Ensure the PDB files are output into the same directory and with the same name
as the static library when using Visual Studio.

Resolves #3701.
  • Loading branch information
pklima committed Nov 7, 2023
1 parent 4548d1e commit 52a99a6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,15 @@ set(FMT_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.")
set_target_properties(fmt PROPERTIES
VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
PUBLIC_HEADER "${FMT_HEADERS}"
DEBUG_POSTFIX "${FMT_DEBUG_POSTFIX}")
DEBUG_POSTFIX "${FMT_DEBUG_POSTFIX}"

# Workaround for Visual Studio 2017:
# Ensure the .pdb is created with the same name and in the same directory
# as the .lib. Newer VS versions already do this by default, but there is no
# harm in setting it for those too. Ignored by other generators.
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
COMPILE_PDB_NAME "fmt"
COMPILE_PDB_NAME_DEBUG "fmt${FMT_DEBUG_POSTFIX}")

# Set FMT_LIB_NAME for pkg-config fmt.pc. We cannot use the OUTPUT_NAME target
# property because it's not set by default.
Expand Down

1 comment on commit 52a99a6

@jaw
Copy link

@jaw jaw commented on 52a99a6 Apr 9, 2024

Choose a reason for hiding this comment

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

@pklima unfortunately this breaks msvc2022 a bit. See #3926
As you possibly have the fail state on your end warranting this change, would you have time to revisit this and either make it optional or actually detect that one is running msvc2017 and then add those properties?
Would be a great help!

Please sign in to comment.