[CMake] static & shared library
Brad King
brad.king at kitware.com
Wed Aug 3 17:32:07 EDT 2005
William A. Hoffman wrote:
> Yes, that is correct, although many autotools projects I have seen work the way cmake does.
> I guess you could do something like this:
>
>
> SET(FOO_SRCS ...)
> ADD_LIBRARY(fooStatic STATIC ${FOO_SRCS})
> ADD_LIBRARY(fooShared SHARED ${FOO_SRCS})
> SET_TARGET_PROPERTIES(fooStatic fooShared PROPERTIES OUTPUT_NAME foo)
>
> I am not sure TARGET_LINK_LIBRARIES would work correctly, but it would
> build a libfoo.so and a libfoo.a in the same build.
There are two other reasons this will not work:
1.) OUTPUT_NAME is only available in CMake 2.2, not 2.0
2.) OUTPUT_NAME is only implemented for ADD_EXECUTABLE targets
-Brad
More information about the CMake
mailing list