diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2022-06-27 02:15:24 +0000 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2022-06-27 02:15:24 +0000 |
commit | d28ac67dde77566f53a97f22b4ea7cb36afe6582 (patch) | |
tree | 10aea5c74975e86bdc7787bf1f1837b2f49a18f0 | |
parent | 5d98f7825a0f5c15132036788fd598716718f0cb (diff) | |
download | json-c-d28ac67dde77566f53a97f22b4ea7cb36afe6582.tar.gz |
Fix issue #775 - use a loop instead of list(TRANSFORM ...) to support cmake < 3.12.
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89cff3f..eb53cef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,7 +531,17 @@ if (UNIX OR MINGW OR CYGWIN) # Linking against the static json-c requires # dependent packages to include additional libs: SET(LIBS_LIST ${CMAKE_REQUIRED_LIBRARIES}) - list(TRANSFORM LIBS_LIST PREPEND "-l") + + # Note: We would need cmake >= 3.12 in order to use list(TRANSFORM ...) + function(list_transform_prepend var prefix) + set(temp "") + foreach(f ${${var}}) + list(APPEND temp "${prefix}${f}") + endforeach() + set(${var} "${temp}" PARENT_SCOPE) + endfunction() + list_transform_prepend(LIBS_LIST "-l") + string(REPLACE ";" " " LIBS "${LIBS_LIST}") configure_file(json-c.pc.in json-c.pc @ONLY) |