diff options
| author | silvanshade <[email protected]> | 2025-04-03 09:27:15 -0600 |
|---|---|---|
| committer | Henrik Gaßmann <[email protected]> | 2025-04-03 21:55:37 +0200 |
| commit | 4aa0811d171d619a04d213fbefbe23fa392db2dc (patch) | |
| tree | 33e43fc0aab04cc1b0167db7981ad4907b103455 | |
| parent | ad639b126ef9b5f3b131093363cc3bb6bba4c3bf (diff) | |
Fix pkg-config CFLAGS for multiple features
| -rw-r--r-- | c/CMakeLists.txt | 15 | ||||
| -rw-r--r-- | c/libblake3.pc.in | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index c7ca78f..6cd742d 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -127,13 +127,13 @@ add_library(blake3 add_library(BLAKE3::blake3 ALIAS blake3) # library configuration -set(BLAKE3_PKGCONFIG_CFLAGS) +set(PKG_CONFIG_CFLAGS) if (BUILD_SHARED_LIBS) target_compile_definitions(blake3 PUBLIC BLAKE3_DLL PRIVATE BLAKE3_DLL_EXPORTS ) - list(APPEND BLAKE3_PKGCONFIG_CFLAGS -DBLAKE3_DLL) + list(APPEND PKG_CONFIG_CFLAGS -DBLAKE3_DLL) endif() target_include_directories(blake3 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> @@ -241,7 +241,7 @@ if(BLAKE3_USE_TBB) BLAKE3_USE_TBB) endif() list(APPEND PKG_CONFIG_REQUIRES "tbb >= ${TBB_VERSION}") - list(APPEND BLAKE3_PKGCONFIG_CFLAGS -DBLAKE3_USE_TBB) + list(APPEND PKG_CONFIG_CFLAGS -DBLAKE3_USE_TBB) endif() if(BLAKE3_USE_TBB) @@ -332,17 +332,17 @@ 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. +# In-place rewrite a string and and join by `sep`. # # TODO: Replace function with list(JOIN) when updating to CMake 3.12 -function(join_pkg_config_requires requires) +function(join_pkg_config_field sep requires) set(_requires "${${requires}}") # avoid shadowing issues, e.g. "${requires}"=len list(LENGTH "${requires}" len) set(idx 1) foreach(req IN LISTS _requires) string(APPEND acc "${req}") if(idx LESS len) - string(APPEND acc ", ") + string(APPEND acc "${sep}") endif() math(EXPR idx "${idx} + 1") endforeach() @@ -350,7 +350,8 @@ function(join_pkg_config_requires requires) endfunction() # pkg-config support -join_pkg_config_requires(PKG_CONFIG_REQUIRES) +join_pkg_config_field(", " PKG_CONFIG_REQUIRES) +join_pkg_config_field(" " PKG_CONFIG_CFLAGS) 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 900913b..e1a61e5 100644 --- a/c/libblake3.pc.in +++ b/c/libblake3.pc.in @@ -9,4 +9,4 @@ Version: @PROJECT_VERSION@ Requires: @PKG_CONFIG_REQUIRES@ Libs: -L"${libdir}" -lblake3 -Cflags: -I"${includedir}" @BLAKE3_PKGCONFIG_CFLAGS@ +Cflags: -I"${includedir}" @PKG_CONFIG_CFLAGS@ |
