cmake: detect fts also in external lib

Not all libc implementations support fts. fts support may be added via
an external library.

One such example is musl libc. It doesn't support fts. But support for
fts can be added to the target device via musl-fts, which provides
libfts.

When libzip encounters such a setup (fts.h available but symbols in
libfts.so) the build fails at the linking stage:

zipcmp.c:(.text.startup+0x130): undefined reference to `fts_open'
/home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-8.3.0_musl/lib/gcc/mips-openwrt-linux-musl/8.3.0/../../../../mips-openwrt-linux-musl/bin/ld: zipcmp.c:(.text.startup+0x172): undefined reference to `fts_read'

This commit sets up cmake so that it checks for fts symbols first in
libc and - if none encountered there - in an external libfts. So in case
libc provides fts nothing changes, libzip will use libc's fts symbols
(if fts.h is present). If on the other hand libc doesn't provide fts but
libfts does, it'll link it in where required (zipcmp).

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2 files changed
tree: 6d0eb3ffacc54b513e0b657fa2e983c75b60c44a
  1. .github/
  2. android/
  3. developer-xcode/
  4. docs/
  5. examples/
  6. lib/
  7. man/
  8. regress/
  9. src/
  10. vstudio/
  11. .clang-format
  12. .gitattributes
  13. .gitignore
  14. .travis.yml
  15. API-CHANGES.md
  16. appveyor.yml
  17. AUTHORS
  18. cmake-config.h.in
  19. cmake-zipconf.h.in
  20. CMakeLists.txt
  21. create-cmake-config.h.in.pl
  22. FindNettle.cmake
  23. INSTALL.md
  24. libzip.pc.in
  25. LICENSE
  26. NEWS.md
  27. README.md
  28. THANKS
  29. TODO.md
README.md

This is libzip, a C library for reading, creating, and modifying zip archives. Files can be added from data buffers, files, or compressed data copied directly from other zip archives. Changes made without closing the archive can be reverted. Decryption and encryption of Winzip AES and decryption of legacy PKware encrypted files is supported. The API is documented by man pages.

libzip is fully documented via man pages. HTML versions of the man pages are on libzip.org and in the man directory. You can start with libzip(3), which lists all others. Example source code is in the examples and src subdirectories.

If you have developed an application using libzip, you can find out about API changes and how to adapt your code for them in the included file API-CHANGES.md.

See the INSTALL.md file for installation instructions and dependencies.

If you make a binary distribution, please include a pointer to the distribution site:

https://libzip.org/

The latest version can always be found there. The official repository is at github.

There is a mailing list for developers using libzip. You can subscribe to it by sending a mail with the subject “subscribe libzip-discuss” to minimalist at nih.at. List mail should be sent to libzip-discuss at nih.at. Use this for bug reports or questions.

If you want to reach the authors in private, use libzip@nih.at.

Travis Build Status Appveyor Build status Coverity Status