CMake: Fix Chain building if CMAKE runtime paths not set

This fixes issues created by #708

Fix By: Brad House (@bradh352)
pull/721/head
Brad House 9 months ago
parent cbf6b0ecdf
commit d322313040
  1. 2
      CMakeLists.txt
  2. 19
      src/lib/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_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
SET (CMAKE_ARCHIVE_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 () ENDIF ()
# Destinations for installing different kinds of targets (pass to install command). # Destinations for installing different kinds of targets (pass to install command).

@ -31,7 +31,6 @@ IF (CARES_SHARED)
EXPORT_NAME cares EXPORT_NAME cares
OUTPUT_NAME cares OUTPUT_NAME cares
COMPILE_PDB_NAME cares COMPILE_PDB_NAME cares
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
SOVERSION ${CARES_LIB_VERSION_MAJOR} SOVERSION ${CARES_LIB_VERSION_MAJOR}
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}" VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}"
C_STANDARD 90 C_STANDARD 90
@ -65,11 +64,13 @@ IF (CARES_SHARED)
COMPONENT Library COMPONENT Library
${TARGETS_INST_DEST} ${TARGETS_INST_DEST}
) )
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb IF (MSVC)
DESTINATION ${CMAKE_INSTALL_BINDIR} INSTALL(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
COMPONENT Library DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL COMPONENT Library
) OPTIONAL
)
ENDIF ()
ENDIF () ENDIF ()
SET (STATIC_SUFFIX "_static") SET (STATIC_SUFFIX "_static")
@ -88,7 +89,6 @@ IF (CARES_STATIC)
EXPORT_NAME cares${STATIC_SUFFIX} EXPORT_NAME cares${STATIC_SUFFIX}
OUTPUT_NAME cares${STATIC_SUFFIX} OUTPUT_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_NAME cares${STATIC_SUFFIX} COMPILE_PDB_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
C_STANDARD 90 C_STANDARD 90
) )
@ -116,11 +116,6 @@ IF (CARES_STATIC)
INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel
${TARGETS_INST_DEST} ${TARGETS_INST_DEST}
) )
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares${STATIC_SUFFIX}.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF () ENDIF ()
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares). # For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).

Loading…
Cancel
Save