suggested PROJECT_NAME change broke chain building as it needs the magic PROJECT_NAME set in the ADD_LIBRARY for matching. Fix to make both goals work

pull/64/head
Brad House 8 years ago
parent bc14ee76b9
commit 1d8077b285
  1. 25
      CMakeLists.txt

@ -53,7 +53,7 @@ ENDIF ()
# build paths rather than an already-installed version.
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
SET (CARES_INCLUDE_DIRS "${PROJECT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "CARES INCLUDE DIRECTORIES")
SET (CARES_LIBRARIES cares CACHE INTERNAL "CARES LIBRARIES")
SET (CARES_LIBRARIES ${PROJECT_NAME} CACHE INTERNAL "CARES LIBRARIES")
IF (CARES_STATIC AND NOT CARES_SHARED)
SET (CARES_DEFINITIONS "-DCARES_STATICLIB" CACHE INTERNAL "CARES DEFINITIONS")
ENDIF ()
@ -536,8 +536,8 @@ include(${PROJECT_BINARY_DIR}/Makefile.inc.cmake)
# Build the dynamic/shared library
IF (CARES_SHARED)
ADD_LIBRARY (cares SHARED ${CSOURCES})
SET_TARGET_PROPERTIES (cares PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_BUILDING_LIBRARY")
ADD_LIBRARY (${PROJECT_NAME} SHARED ${CSOURCES})
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_BUILDING_LIBRARY" OUTPUT_NAME cares)
# Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and SOVERSION
# Convert from ":" separated into CMake list format using ";"
@ -548,25 +548,26 @@ IF (CARES_SHARED)
MATH (EXPR CARES_LIB_VERSION_MAJOR "${CARES_LIB_VERSION_CURRENT} - ${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_MINOR "${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}")
SET_TARGET_PROPERTIES (cares PROPERTIES VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}")
SET_TARGET_PROPERTIES (cares PROPERTIES SOVERSION "${CARES_LIB_VERSION_MAJOR}")
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}")
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES SOVERSION "${CARES_LIB_VERSION_MAJOR}")
TARGET_LINK_LIBRARIES (cares ${CARES_DEPENDENT_LIBS})
TARGET_LINK_LIBRARIES (${PROJECT_NAME} ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS cares DESTINATION ${CARES_INSTALL_LOCATION_LIBS})
INSTALL (TARGETS ${PROJECT_NAME} DESTINATION ${CARES_INSTALL_LOCATION_LIBS})
ENDIF ()
SET (STATIC_SUFFIX "_static")
ENDIF ()
# Build the static library
IF (CARES_STATIC)
ADD_LIBRARY (cares-static STATIC ${CSOURCES})
SET_TARGET_PROPERTIES (cares-static PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_STATICLIB" OUTPUT_NAME cares)
ADD_LIBRARY (${PROJECT_NAME}${STATIC_SUFFIX} STATIC ${CSOURCES})
SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H=1 -DCARES_STATICLIB" OUTPUT_NAME cares)
IF (CARES_STATIC_PIC)
SET_TARGET_PROPERTIES (cares-static PROPERTIES POSITION_INDEPENDENT_CODE True)
SET_TARGET_PROPERTIES (${PROJECT_NAME}${STATIC_SUFFIX} PROPERTIES POSITION_INDEPENDENT_CODE True)
ENDIF ()
TARGET_LINK_LIBRARIES (cares-static ${CARES_DEPENDENT_LIBS})
TARGET_LINK_LIBRARIES (${PROJECT_NAME}${STATIC_SUFFIX} ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS cares-static DESTINATION ${CARES_INSTALL_LOCATION_LIBS})
INSTALL (TARGETS ${PROJECT_NAME}${STATIC_SUFFIX} DESTINATION ${CARES_INSTALL_LOCATION_LIBS})
ENDIF ()
ENDIF ()

Loading…
Cancel
Save