From 0cb7ae83b2b579dc0f6a258dafb606723e6e740b Mon Sep 17 00:00:00 2001
From: Petr Klima
Date: Sat, 4 Nov 2023 17:05:02 +1100
Subject: [PATCH] Set PDB path for Visual Studio
Ensure the PDB files are output into the same directory and with the same name
as the static library when using Visual Studio.
Resolves fmtlib#3701.
---
CMakeLists.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2a54b5f6f11c..0c8698bb16bb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -312,7 +312,10 @@ 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}"
+ 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.