From 498fea3fe0bdbbf7f6f329dafc862855e27ada0c Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Wed, 27 May 2020 11:18:48 -0400 Subject: [PATCH] Add generation of pkg-config file --- cmake/inputs/tiledb.pc.in | 14 ++++++++++++++ tiledb/CMakeLists.txt | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 cmake/inputs/tiledb.pc.in diff --git a/cmake/inputs/tiledb.pc.in b/cmake/inputs/tiledb.pc.in new file mode 100644 index 00000000000..ac54c2f8192 --- /dev/null +++ b/cmake/inputs/tiledb.pc.in @@ -0,0 +1,14 @@ +prefix="@CMAKE_INSTALL_PREFIX@" +exec_prefix="${prefix}" +libdir="${prefix}/@CMAKE_INSTALL_LIBDIR@" +includedir="${prefix}/include/tiledb" + +Name: TileDB +Description: The Storage Engine for Data Science +URL: https://github.com/TileDB-Inc/TileDB +Version: @VERSION@ +Requires: @PKGCONF_REQ_PUB@ +Requires.private: @PKGCONF_REQ_PRIV@ +Cflags: -I"${includedir}" +Libs: -L"${libdir}" -ltiledb +Libs.private: -L"${libdir}" -ltiledb @PKGCONF_LIBS_PRIV@ \ No newline at end of file diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index 860dd88985f..36c86c50ecd 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -763,3 +763,25 @@ install( NAMESPACE "${PROJECT_NAME}::" DESTINATION "${CONFIG_INSTALL_DIR}" ) + +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/sm/c_api/tiledb_version.h" ver) + +string(REGEX MATCH "TILEDB_VERSION_MAJOR ([0-9]*)" _ ${ver}) +set(ver_major ${CMAKE_MATCH_1}) + +string(REGEX MATCH "TILEDB_VERSION_MINOR ([0-9]*)" _ ${ver}) +set(ver_minor ${CMAKE_MATCH_1}) + +string(REGEX MATCH "TILEDB_VERSION_PATCH ([0-9]*)" _ ${ver}) +set(ver_patch ${CMAKE_MATCH_1}) + +set(VERSION "${ver_major}.${ver_minor}.${ver_patch}") + +# PKG Config file +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/inputs/tiledb.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/tiledb.pc + @ONLY +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tiledb.pc + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig) \ No newline at end of file