# tinyldap CMake build This fork can be built with CMake in addition to the original Makefile. The CMake build is out-of-tree friendly and can be used either as a top-level project or via `add_subdirectory()`. ## Basic build ```sh cmake -S . -B build cmake --build build ctest --test-dir build --output-on-failure cmake --install build --prefix /usr/local ``` By default CMake builds a shared library, the server and the same command-line tools that the original Makefile builds. ## Static and shared libraries ```sh cmake -S . -B build \ -DTINYLDAP_BUILD_STATIC=ON \ -DTINYLDAP_BUILD_SHARED=ON ``` ## Custom server and library name `TINYLDAP_OUTPUT_NAME` controls the library basename and, unless overridden, the server executable name: ```sh cmake -S . -B build -DTINYLDAP_OUTPUT_NAME=nwdirectory ``` This builds `libnwdirectory.so` / `libnwdirectory.a` and a server named `nwdirectory`. For a different server name only: ```sh cmake -S . -B build \ -DTINYLDAP_OUTPUT_NAME=nwdirectory \ -DTINYLDAP_SERVER_NAME=my-ldapd ``` ## Include layout Public headers are exported under an include subdirectory. By default it matches `TINYLDAP_OUTPUT_NAME`: ```c #include ``` or with `-DTINYLDAP_OUTPUT_NAME=nwdirectory`: ```c #include ``` The build tree has the same layout under `${binary_dir}/include`, which makes submodule use straightforward. ## libowfat dependency When libowfat is already present in the parent build, TinyLDAP uses the target `libowfat::libowfat`. Otherwise it tries `find_package(libowfat CONFIG)` and then a plain library lookup. TinyLDAP sources use `#include `. If the libowfat build exports a prefixed include directory such as `nwlibowfat`, set: ```sh -DTINYLDAP_LIBOWFAT_INCLUDE_SUBDIR=nwlibowfat ``` When TinyLDAP is added below the CMake libowfat build, this is detected from `LIBOWFAT_INSTALL_INCLUDE_SUBDIR` automatically. ## OpenSSL / MatrixSSL compat TinyLDAP currently needs OpenSSL-style MD5 APIs for `auth.c` and `md5password.c`. If the parent project already provides `OpenSSL::Crypto` via MatrixSSL's OpenSSL-compat target, TinyLDAP will use it. Otherwise CMake falls back to the system OpenSSL Crypto library.