[CMake] making two targets with similar names

Juan Sanchez Juan.Sanchez at amd.com
Fri Aug 10 14:41:35 EDT 2007


I am having the following issue.  I want to create both a libFOO.a and a
libFOO.so.  Note that the libFOO.so is composed of more sources than the
libFOO.a.

I use OUTPUT_NAME in order so they have the same name.  I can make the
FOOSTATIC, libFOO.a, target, just fine.  However, making the FOODYNAMIC,
libFOO.so, target deletes libFOO.a, just before linking against it.
This causes a build error.

Is there anyway to prevent this from happening?


ADD_LIBRARY (FOOSTATIC  STATIC ${UDB_SRCS})
ADD_LIBRARY (FOODYNAMIC SHARED ${PERL_SRCS})

target_link_libraries(FOODYNAMIC  FOOSTATIC)

SET_TARGET_PROPERTIES(FOODYNAMIC PROPERTIES
    LINK_FLAGS --whole-archive
    OUTPUT_NAME   FOO
)

SET_TARGET_PROPERTIES(FOOSTATIC PROPERTIES
    OUTPUT_NAME   FOO
)


Thanks,

Juan




More information about the CMake mailing list