|
|
|
@ -529,25 +529,30 @@ IF (CARES_SHARED) |
|
|
|
|
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}") |
|
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES |
|
|
|
|
EXPORT_NAME cares |
|
|
|
|
OUTPUT_NAME cares |
|
|
|
|
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}" |
|
|
|
|
SOVERSION "${CARES_LIB_VERSION_MAJOR}" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") |
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>") |
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>") |
|
|
|
|
|
|
|
|
|
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY) |
|
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
|
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
|
|
|
|
INSTALL (TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets |
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR} |
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
|
|
|
|
) |
|
|
|
|
ENDIF () |
|
|
|
|
SET (STATIC_SUFFIX "_static") |
|
|
|
|
|
|
|
|
|
# For chain building: add alias targets that look like import libs that would be returned by find_package(Cares). |
|
|
|
|
ADD_LIBRARY (Cares::cares_shared ALIAS ${PROJECT_NAME}) |
|
|
|
|
ADD_LIBRARY (Cares::cares ALIAS ${PROJECT_NAME}) |
|
|
|
|
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares). |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME}::cares_shared ALIAS ${PROJECT_NAME}) |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${PROJECT_NAME}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# Build the static library |
|
|
|
@ -556,12 +561,17 @@ IF (CARES_STATIC) |
|
|
|
|
|
|
|
|
|
ADD_LIBRARY (${LIBNAME} STATIC ${CSOURCES}) |
|
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES OUTPUT_NAME cares) |
|
|
|
|
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES |
|
|
|
|
EXPORT_NAME cares${STATIC_SUFFIX} |
|
|
|
|
OUTPUT_NAME cares |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
IF (CARES_STATIC_PIC) |
|
|
|
|
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE True) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") |
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>") |
|
|
|
|
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>") |
|
|
|
|
|
|
|
|
|
TARGET_COMPILE_DEFINITIONS (${LIBNAME} |
|
|
|
|
PUBLIC CARES_STATICLIB |
|
|
|
@ -570,14 +580,17 @@ IF (CARES_STATIC) |
|
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS}) |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
INSTALL (TARGETS ${LIBNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
|
|
|
|
INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets |
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR} |
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
|
|
|
|
) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# For chain building: add alias targets that look like import libs that would be returned by find_package(Cares). |
|
|
|
|
ADD_LIBRARY (Cares::cares_static ALIAS ${LIBNAME}) |
|
|
|
|
IF (NOT TARGET Cares::cares) |
|
|
|
|
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares). |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME}::cares_static ALIAS ${LIBNAME}) |
|
|
|
|
IF (NOT TARGET ${PROJECT_NAME}::cares) |
|
|
|
|
# Only use static for the generic alias if shared lib wasn't built. |
|
|
|
|
ADD_LIBRARY (Cares::cares ALIAS ${LIBNAME}) |
|
|
|
|
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${LIBNAME}) |
|
|
|
|
ENDIF () |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
@ -588,11 +601,23 @@ IF (CARES_INSTALL) |
|
|
|
|
INSTALL (FILES ${CARES_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# Export targets |
|
|
|
|
IF (CARES_INSTALL) |
|
|
|
|
SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") |
|
|
|
|
INCLUDE (CMakePackageConfigHelpers) |
|
|
|
|
CONFIGURE_PACKAGE_CONFIG_FILE (${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake |
|
|
|
|
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} |
|
|
|
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR |
|
|
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO |
|
|
|
|
) |
|
|
|
|
INSTALL (EXPORT ${PROJECT_NAME}-targets DESTINATION ${CMAKECONFIG_INSTALL_DIR} NAMESPACE ${PROJECT_NAME}::) |
|
|
|
|
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" DESTINATION ${CMAKECONFIG_INSTALL_DIR}) |
|
|
|
|
ENDIF () |
|
|
|
|
|
|
|
|
|
# Legacy chain-building variables (provided for compatibility with old code). |
|
|
|
|
# Don't use these, external code should be updated to refer to the aliases directly (e.g., Cares::cares). |
|
|
|
|
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND") |
|
|
|
|
SET (CARES_LIBRARIES Cares::cares CACHE INTERNAL "CARES LIBRARIES") |
|
|
|
|
SET (CARES_LIBRARIES ${PROJECT_NAME}::cares CACHE INTERNAL "CARES LIBRARIES") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Build ahost |
|
|
|
|