From 95f4b01a6529048aad95dc0ad5379afa04d8b07c Mon Sep 17 00:00:00 2001 From: Mathieu Westphal <mathieu.westphal@kitware.com> Date: Wed, 26 Feb 2025 14:56:47 +0100 Subject: [PATCH] CMake: Install cdilib, headers and CMake config files --- src/CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f21e7c023..6b212b8d1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -204,3 +204,24 @@ target_compile_definitions(cdilib PRIVATE PACKAGE_NAME="${PROJECT_NAME}" VERSION add_library(cdilib::cdilib ALIAS cdilib) +include(GNUInstallDirs) +install(FILES cdi.h calendar.h cdi_datetime.h julian_date.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(TARGETS cdilib + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + +include(CMakePackageConfigHelpers) +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cdi/cdi-config.cmake.in" "${CMAKE_BINARY_DIR}/cmake/cdi-config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cdi") +write_basic_package_version_file( + "${CMAKE_BINARY_DIR}/cmake/cdi-config-version.cmake" + VERSION "${PACKAGE_VERSION}" + COMPATIBILITY SameMajorVersion) +install( + FILES + "${CMAKE_BINARY_DIR}/cmake/cdi-config.cmake" + "${CMAKE_BINARY_DIR}/cmake/cdi-config-version.cmake" + DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/cdi") -- GitLab