From d322313040f9b7815b16bea1115474471f3f8a28 Mon Sep 17 00:00:00 2001 From: Brad House Date: Fri, 1 Mar 2024 06:22:46 -0500 Subject: [PATCH] CMake: Fix Chain building if CMAKE runtime paths not set This fixes issues created by #708 Fix By: Brad House (@bradh352) --- CMakeLists.txt | 2 +- src/lib/CMakeLists.txt | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cfc810f..a63c5731 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ IF (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") - SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) + SET (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") ENDIF () # Destinations for installing different kinds of targets (pass to install command). diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 015e57f8..de73f712 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -31,7 +31,6 @@ IF (CARES_SHARED) EXPORT_NAME cares OUTPUT_NAME cares COMPILE_PDB_NAME cares - COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} SOVERSION ${CARES_LIB_VERSION_MAJOR} VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}" C_STANDARD 90 @@ -65,11 +64,13 @@ IF (CARES_SHARED) COMPONENT Library ${TARGETS_INST_DEST} ) - INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT Library - OPTIONAL - ) + IF (MSVC) + INSTALL(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT Library + OPTIONAL + ) + ENDIF () ENDIF () SET (STATIC_SUFFIX "_static") @@ -88,7 +89,6 @@ IF (CARES_STATIC) EXPORT_NAME cares${STATIC_SUFFIX} OUTPUT_NAME cares${STATIC_SUFFIX} COMPILE_PDB_NAME cares${STATIC_SUFFIX} - COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} C_STANDARD 90 ) @@ -116,11 +116,6 @@ IF (CARES_STATIC) INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel ${TARGETS_INST_DEST} ) - INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares${STATIC_SUFFIX}.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT Library - OPTIONAL - ) ENDIF () # For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).