diff options
| author | Alexandru Ardelean | 2021-10-29 08:54:43 +0000 |
|---|---|---|
| committer | Rafał Miłecki | 2021-11-04 06:17:16 +0000 |
| commit | cd3f6ee42e5c60d55b02e2bbad3db217c77e66ce (patch) | |
| tree | 5a41582914f43b6c2d5fdb440730792041698f27 | |
| parent | 70737600d9385486df5c1970b4ab41ccb17006fa (diff) | |
| download | firmware-utils-cd3f6ee42e5c60d55b02e2bbad3db217c77e66ce.tar.gz | |
build, cmake: add quotes for FW_UTIL variable arguments
CMake macro arguments are special, so when passing ${ZLIB_LIBRARIES} as
an argument, this can actually be a list of strings.
In this case, the first library (for zlib) will be added to
TARGET_LINK_LIBRARIES() and the others will be discarded. This is likely
due to some expansion from the FW_UTIL macro.
So, if FindZLIB returns more libraries for linking, they will not be
considered.
This is the case when trying to change OPENSSL_CRYPTO_LIBRARY ->
OPENSSL_CRYPTO_LIBRARIES.
OPENSSL_CRYPTO_LIBRARY is just libcrypto.a
OPENSSL_CRYPTO_LIBRARIES can also include -ldl
There's a few points made here about macros:
https://cmake.org/cmake/help/latest/command/macro.html#argument-caveats
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Reviewed-by: Petr Štetiar <ynezz@true.cz>
| -rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 556ec72..3e206a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,10 @@ ADD_DEFINITIONS(-Wall -Wno-unused-parameter) MACRO(FW_UTIL util deps extra_cflags libs) ADD_EXECUTABLE(${util} src/${util}.c ${deps}) INSTALL(TARGETS ${util} RUNTIME) - IF(NOT ${ARGV2} STREQUAL "") + IF(NOT "${extra_cflags}" STREQUAL "") SET_TARGET_PROPERTIES(${util} PROPERTIES COMPILE_FLAGS ${extra_cflags}) ENDIF() - IF(NOT ${ARGV3} STREQUAL "") + IF(NOT "${libs}" STREQUAL "") TARGET_LINK_LIBRARIES(${util} ${libs}) ENDIF() ENDMACRO(FW_UTIL) @@ -42,9 +42,9 @@ FW_UTIL(encode_crc "" "" "") FW_UTIL(fix-u-media-header src/cyg_crc32.c "" "") FW_UTIL(hcsmakeimage src/bcmalgo.c "" "") FW_UTIL(imagetag "src/imagetag_cmdline.c;src/cyg_crc32.c" "" "") -FW_UTIL(jcgimage "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(jcgimage "" "" "${ZLIB_LIBRARIES}") FW_UTIL(lxlfw "" "" "") -FW_UTIL(lzma2eva "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(lzma2eva "" "" "${ZLIB_LIBRARIES}") FW_UTIL(makeamitbin "" "" "") FW_UTIL(mkbrncmdline "" "" "") FW_UTIL(mkbrnimg "" "" "") @@ -56,20 +56,20 @@ FW_UTIL(mkcsysimg "" "" "") FW_UTIL(mkdapimg "" "" "") FW_UTIL(mkdapimg2 "" "" "") FW_UTIL(mkdhpimg src/buffalo-lib.c "" "") -FW_UTIL(mkdlinkfw src/mkdlinkfw-lib.c --std=c99 ${ZLIB_LIBRARIES}) +FW_UTIL(mkdlinkfw src/mkdlinkfw-lib.c --std=c99 "${ZLIB_LIBRARIES}") FW_UTIL(mkdniimg "" "" "") FW_UTIL(mkedimaximg "" "" "") -FW_UTIL(mkfwimage "" "-Wextra -D_FILE_OFFSET_BITS=64" ${ZLIB_LIBRARIES}) -FW_UTIL(mkfwimage2 "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(mkheader_gemtek "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(mkhilinkfw "" "" ${OPENSSL_CRYPTO_LIBRARY}) +FW_UTIL(mkfwimage "" "-Wextra -D_FILE_OFFSET_BITS=64" "${ZLIB_LIBRARIES}") +FW_UTIL(mkfwimage2 "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(mkheader_gemtek "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(mkhilinkfw "" "" "${OPENSSL_CRYPTO_LIBRARY}") FW_UTIL(mkmerakifw src/sha1.c "" "") FW_UTIL(mkmerakifw-old "" "" "") FW_UTIL(mkmylofw "" "" "") FW_UTIL(mkplanexfw src/sha1.c "" "") FW_UTIL(mkporayfw "" "" "") FW_UTIL(mkrasimage "" --std=gnu99 "") -FW_UTIL(mkrtn56uimg "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(mkrtn56uimg "" "" "${ZLIB_LIBRARIES}") FW_UTIL(mksenaofw src/md5.c --std=gnu99 "") FW_UTIL(mksercommfw "" "" "") FW_UTIL(mktitanimg "" "" "") @@ -96,8 +96,8 @@ FW_UTIL(tplink-safeloader src/md5.c --std=gnu99 "") FW_UTIL(trx "" "" "") FW_UTIL(trx2edips "" "" "") FW_UTIL(trx2usr "" "" "") -FW_UTIL(uimage_padhdr "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(uimage_sgehdr "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(uimage_padhdr "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(uimage_sgehdr "" "" "${ZLIB_LIBRARIES}") FW_UTIL(wrt400n src/cyg_crc32.c "" "") FW_UTIL(xiaomifw "" "" "") FW_UTIL(xorimage "" "" "") |