diff options
| author | silvanshade <[email protected]> | 2025-03-31 14:18:59 -0600 |
|---|---|---|
| committer | Henrik Gaßmann <[email protected]> | 2025-04-02 18:40:22 +0200 |
| commit | 3f089cb8c7a90180107f0d6981e85aa8106a9c8e (patch) | |
| tree | 899a3ae04795afc41702bef12b8d3becce3443e2 | |
| parent | 00c2ea974d33d19d91d8de3c12ff8c8eb1fc8dbd (diff) | |
Propagate tbb through pkg-config
| -rw-r--r-- | c/CMakeLists.txt | 23 | ||||
| -rw-r--r-- | c/libblake3.pc.in | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index c929d71..ba3b855 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -330,6 +330,29 @@ function(join_paths joined_path first_path_segment) set(${joined_path} "${temp_path}" PARENT_SCOPE) endfunction() +# In-place rewrite a list of strings `requires` into a comma separated string. +# +# TODO: Replace function with list(JOIN) when updating to CMake 3.12 +function(join_pkg_config_requires requires) + list(LENGTH ${requires} len) + set(idx 1) + foreach(req ${${requires}}) + string(APPEND acc ${req}) + if(idx LESS len) + string(APPEND acc ", ") + endif() + math(EXPR idx "${idx} + 1") + endforeach() + set(${requires} ${acc} PARENT_SCOPE) +endfunction() + +# calculate pkg-config requirements +if(BLAKE3_USE_TBB) + list(APPEND PKG_CONFIG_REQUIRES "tbb >= ${TBB_VERSION}") +endif() + +# pkg-config support +join_pkg_config_requires(PKG_CONFIG_REQUIRES) join_paths(PKG_CONFIG_INSTALL_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") join_paths(PKG_CONFIG_INSTALL_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") configure_file(libblake3.pc.in libblake3.pc @ONLY) diff --git a/c/libblake3.pc.in b/c/libblake3.pc.in index 06f2c7a..900913b 100644 --- a/c/libblake3.pc.in +++ b/c/libblake3.pc.in @@ -7,6 +7,6 @@ Name: @PROJECT_NAME@ Description: @PROJECT_DESCRIPTION@ Version: @PROJECT_VERSION@ -Requires: +Requires: @PKG_CONFIG_REQUIRES@ Libs: -L"${libdir}" -lblake3 Cflags: -I"${includedir}" @BLAKE3_PKGCONFIG_CFLAGS@ |
