diff options
| author | Henrik Gaßmann <[email protected]> | 2025-04-02 18:29:42 +0200 |
|---|---|---|
| committer | Henrik Gaßmann <[email protected]> | 2025-04-02 18:40:22 +0200 |
| commit | 339abc57529cbfed0edcd511a306e6a1d1f48d67 (patch) | |
| tree | 8240731d879225b546c6b98d15dc7ad30b1dc17d | |
| parent | 89843490f2f6c535bfabb164bdad80043c8f6afd (diff) | |
refactor: fix a few nits in the join function
The `join_pkg_config_requires` function would misbehave in a few edge cases. Though these edge cases aren't triggered by our current usage.
| -rw-r--r-- | c/CMakeLists.txt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index ba3b855..d723983 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -334,16 +334,17 @@ endfunction() # # TODO: Replace function with list(JOIN) when updating to CMake 3.12 function(join_pkg_config_requires requires) - list(LENGTH ${requires} len) + set(_requires "${${requires}}") # avoid shadowing issues, e.g. "${requires}"=len + list(LENGTH "${requires}" len) set(idx 1) - foreach(req ${${requires}}) - string(APPEND acc ${req}) + foreach(req IN LISTS _requires) + string(APPEND acc "${req}") if(idx LESS len) string(APPEND acc ", ") endif() math(EXPR idx "${idx} + 1") endforeach() - set(${requires} ${acc} PARENT_SCOPE) + set("${requires}" "${acc}" PARENT_SCOPE) endfunction() # calculate pkg-config requirements |
