[CMake] Fwd: Build shared and static in one build

Totte Karlsson totte at dunescientific.com
Fri May 18 14:14:43 EDT 2012


>
> set(LIBSRC blah.c bouh.c)
>
> add_library(MyLib SHARED ${LIBSRC})
>
> add_library(MyLib-static STATIC ${LIBSRC})
> set_target_properties(MyLibStatic PROPERTIES OUTPUT_NAME MyLib)
>
> should work

That works great.

Not sure what the line
 > set_target_properties(MyLibStatic PROPERTIES OUTPUT_NAME MyLib)
Is doing?

Did you mean
set_target_properties(MyLib-static PROPERTIES OUTPUT_NAME MyLib)
and then that overwrites the dynamic link library lib?


Thanks.
Tk


More information about the CMake mailing list