diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f21e7c0235ba86a5a168df6c1b69303adb7c4da9..6b212b8d1063470b5cff70ab1d812db94e2e56cf 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")