building mariadb 10.0.15 on linux/64 i have a non-system instance of (lib)pcre, installed in /usr/local/test/pcre, that i need to build/link against reading Link MariaDB Client Library for C with specific external zlib and openssl https://mariadb.com/kb/en/mariadb/client-libraries/client-library-for-c/link... i've built with cmake .. \ ... -DCMAKE_C_FLAGS="... -I/usr/local/test/pcre/includes" \ -DCMAKE_CXX_FLAGS="... -I/usr/local/test/pcre/includes" \ -DCMAKE_SHARED_LINKER_FLAGS="... -L/usr/local/test/pcre/lib64 -lpcre" \ ... and cmake .. \ ... -DCMAKE_C_FLAGS="... -I/usr/local/test/pcre/includes" \ -DCMAKE_CXX_FLAGS="... -I/usr/local/test/pcre/includes" \ -DCMAKE_SHARED_LINKER_FLAGS="... -L/usr/local/test/pcre/lib64 -Wl,-rpath,/usr/local/test/pcre/lib64 -lpcre " \ ... but id both cases, the resultant binary still links against system pcre libs ldd sql/mysqld | egrep -i "pcre" libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f6165a5e000) what's the correct method for linking against a specified, non-system path'd lib? specifically, here, libpcre?