[CMake] how to add custom linker flags when creating shared libs
Brad King
brad.king at kitware.com
Tue Apr 19 08:39:58 EDT 2005
Alexander Neundorf wrote:
> what's the best way to add custom options to the linker command when
> creating shared libraries (plugins) ?
[snip]
> Is there a way to get Makefiles which generate plugins without the "lib"
> prefix in the filename ?
This example should answer your questions:
ADD_LIBRARY(myplugin MODULE myplugin.cxx)
SET(CMAKE_MODULE_LINKER_FLAGS -example-flag-1)
SET_TARGET_PROPERTIES(myplugin PROPERTIES
PREFIX ""
LINK_FLAGS -example-flag-2
)
> And a last question, what's the difference between a MODULE and a SHARED
> lib ? Is MODULE intended to be used for plugins ?
This is mainly used for Mac OSX where there is a distinction between
modules (.so) and shared libraries (.dylib). Modules on OSX can link to
libraries but nothing can link to modules. They are meant for plugins.
-Brad
More information about the CMake
mailing list