cmake
add_library documentation says,
SHARED libraries are linked dynamically and loaded at runtime. MODULE libraries are plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality.
Practically, I can see both SHARED
and MODULE
type targets generate .so
dynamic libraries on Linux. .so
libraries are dynamically linked, loaded at runtime and be mapped using dlopen()
. How do these two types of targets differ?
The MODULE
ones are intended to be loaded using dlopen
only. You can't target_link_libraries()
to the MODULE
library.
As documentation states, MODULE
keyword should be used to underline that a library is a plugin of some sort and shouldn't be linked using -l
flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With