diff --git a/CMakeLists.txt b/CMakeLists.txt index acb4b835..4069e1d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/c-ares-config.cmake.in b/c-ares-config.cmake.in index a069648b..464837b3 100644 --- a/c-ares-config.cmake.in +++ b/c-ares-config.cmake.in @@ -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)