[fmt] CMakeLists.txt: Fix installation path; install the PDB file.

Also added DO_SPLIT_DEBUG() and SET_WINDOWS_SUBSYSTEM().
This commit is contained in:
David Korth 2025-04-20 02:15:38 -04:00
parent 5d3ec38bce
commit 8b17f8c5c5

View File

@ -67,6 +67,36 @@ function(add_module_library name)
add_library(${name})
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
# rom-properties
DO_SPLIT_DEBUG(${name})
SET_WINDOWS_SUBSYSTEM(${name} WIN32)
IF(INSTALL_DEBUG)
# FIXME: Generator expression $<TARGET_PROPERTY:${_target},PDB> didn't work with CPack-3.6.1.
INCLUDE(DirInstallPaths)
GET_TARGET_PROPERTY(DEBUG_FILENAME ${name} PDB)
IF(WIN32)
# TODO: Test on MinGW.
# FIXME: Generator PDB expression doesn't have the debug postfix for some reason,
# so cpack fails in debug builds if we get the PDB property.
SET(PDB_FILENAME_D "$<TARGET_FILE_DIR:${name}>/${name}-${CPACK_PACKAGE_VERSION_MAJOR}${CMAKE_DEBUG_POSTFIX}.pdb")
SET(PDB_FILENAME_R "$<TARGET_FILE_DIR:${name}>/${name}-${CPACK_PACKAGE_VERSION_MAJOR}${CMAKE_RELEASE_POSTFIX}.pdb")
INSTALL(FILES "${PDB_FILENAME_D}" "${PDB_FILENAME_R}"
DESTINATION "${DIR_INSTALL_DLL_DEBUG}"
COMPONENT "debug"
OPTIONAL
)
UNSET(PDB_FILENAME_D)
UNSET(PDB_FILENAME_R)
ELSE(WIN32)
INSTALL(FILES "${DEBUG_FILENAME}"
DESTINATION "${DIR_INSTALL_DLL_DEBUG}"
COMPONENT "debug"
)
ENDIF(WIN32)
UNSET(DEBUG_FILENAME)
ENDIF(INSTALL_DEBUG)
if (NOT ${${AML_IF}})
# Create a non-modular library.
target_sources(${name} PRIVATE ${AML_FALLBACK})
@ -463,14 +493,15 @@ if (FMT_INSTALL)
endif()
# Install the library and headers.
# rom-properites: Only install the runtime. (DLL)
# rom-properties: Only install the DLL, and use our custom destination path.
install(TARGETS ${INSTALL_TARGETS}
COMPONENT fmt-core
EXPORT ${targets_export_name}
#LIBRARY DESTINATION ${FMT_LIB_DIR}
#ARCHIVE DESTINATION ${FMT_LIB_DIR}
#PUBLIC_HEADER DESTINATION "${FMT_INC_DIR}/fmt"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
#RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
RUNTIME DESTINATION ${INSTALL_BIN_DIR}
#${INSTALL_FILE_SET})
)