CMake: Provide c-ares version in package export file (#296)

The CMake package export file should provide version information.

Fix By: Kyle Edwards (@KyleFromKitware)
pull/299/head
Kyle Edwards 5 years ago committed by Brad House
parent 14e38b154c
commit 0819848c72
  1. 3
      CMakeLists.txt
  2. 1
      c-ares-config.cmake.in

@ -665,8 +665,9 @@ IF (CARES_INSTALL)
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_NAME}-config-version.cmake VERSION "${CARES_VERSION}" COMPATIBILITY SameMajorVersion)
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})
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" DESTINATION ${CMAKECONFIG_INSTALL_DIR})
# pkgconfig support
IF (NOT CARES_SHARED)

@ -2,6 +2,7 @@
set_and_check(c-ares_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
include("${CMAKE_CURRENT_LIST_DIR}/c-ares-config-version.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/c-ares-targets.cmake")
set(c-ares_LIBRARY c-ares::cares)

Loading…
Cancel
Save