From 9bf18441cd2ec54c63f487a03441bf479c4f192a Mon Sep 17 00:00:00 2001 From: Patrick Huesmann Date: Mon, 30 Jan 2023 18:07:25 +0100 Subject: [PATCH] Add CMake package config --- CMakeLists.txt | 25 ++++++++++++++++++++++--- udmaio-config.cmake.in | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 udmaio-config.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b112e9d..0a1fbaca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) -project(libudmaio VERSION 0.9.3) +project(libudmaio VERSION 1.0.0) find_package(Boost 1.65 COMPONENTS log program_options REQUIRED) @@ -22,10 +22,29 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") endif() include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +configure_package_config_file(udmaio-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/udmaio-config.cmake + INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/udmaio + PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR +) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/udmaio-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + install(TARGETS udmaio PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/udmaio - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/udmaio-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/udmaio-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/udmaio" +) # Invoke cmake with -DTARGET_HW=ZUP or -DTARGET_HW=Z7IO. ZUP is the default if("${TARGET_HW}" STREQUAL "") diff --git a/udmaio-config.cmake.in b/udmaio-config.cmake.in new file mode 100644 index 00000000..a18cb7d4 --- /dev/null +++ b/udmaio-config.cmake.in @@ -0,0 +1 @@ +@PACKAGE_INIT@