Link MariaDB Client Library for C with specific external zlib and openssl
I am trying to link the mariadb client library with zlib and openssl which are neither embedded in mariadb (for zlib), nor the one available on the system: I want to force cmake to use zlib and openssl from a given path.
How can I do that? Is there another way than creating my own FindZLIB.cmake and force it via CMAKE_MODULE_PATH ?
I'm not quite sure what are you doing — building mariadb client library or your own application, that uses cmake and mariadb client library. But anyway, you can specify compiler and linker flags like the following:
cmake -DCMAKE_C_FLAGS=-I/path/to/zlib/includes \ -DCMAKE_EXE_LINKER_FLAGS=-L/path/to/zlib/library
You might need to use
CMAKE_SHARED_LINKER_FLAGS instead of
CMAKE_EXE_LINKER_FLAGS, depending on what you're building.