[CMake] How to link specific static libraries
Michael Wild
themiwi at gmail.com
Wed Jun 29 08:32:26 EDT 2011
On 06/29/2011 02:30 PM, Stephen Torri wrote:
> Normally we use target_link_libraries to link against certain libraries.
> For example:
>
> target_link_libraries ( mytarget A B C )
>
> Well when I am working on creating regressions tests for my library,
> called mytarget, I would use the same CMake command to link against the
> boost unit test framework library. What I curious to know is it possible
> to set properties for a specific library, e.g. B in this scenario, to
> say that
> the build should always link against a static library even if the shared
> library is present?
>
> So in this case A and C would be linked as shared but B would be linked
> as static.
>
> Stephen
>
Either use -static if you are using GCC compilers, but then you're
linking statically against ALL libraries, or pass the full path of the
static library to target_link_libraries().
Michael
More information about the CMake
mailing list