]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Fix issue #775 - use a loop instead of list(TRANSFORM ...) to support cmake < 3.12.
authorEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 27 Jun 2022 02:15:24 +0000 (02:15 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 27 Jun 2022 02:15:24 +0000 (02:15 +0000)
CMakeLists.txt

index 89cff3f7a4a216ece6b6b1863a64b5dda3bf0252..eb53cefc82c949c940455a6d44335ab8d47d828a 100644 (file)
@@ -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)