Do you know the difference between dynamically-linked and statically-linked libraries?
Here's how it works if on Windows.
A statically linked library is a single file, usually with a .a or .lib extension, containing all the library code for a program to make use of. When passed to the linker, it is compiled directly into the final executable.
A dynamically linked library is two files: one with a .a or .lib extension, and one with a .dll extension. The library (.a or .lib) file contains only the data necessary to show the linker that the DLL contains the library code. The final executable does not then contain the library code, but rather looks for and loads the DLL when you run it.
On Linux it's mostly the same, except the compiler uses options like "-shared" and "-fPIC" when creating the dynamic library, and the DLL files are instead .so (Shared Object) files.
Either way, you shouldn't need to give the compiler or linker any extra options; it should be able to determine for itself from the library file whether the library is dynamically or statically linked. The -static command line option actually prevents the linker from correctly linking with dynamic libraries.