[Cmake] Debug and Release library name

Viroleau, Vincent (SCR US EXT) vincent.viroleau.ext at siemens.com
Tue Mar 28 12:41:16 EST 2006


Hi,

I'm working with Cmake and VS2005, and I would like to have, in the same project,
a different name of the library I'm building depending on if I'm on Debug or Release configuration.

For example, if I'm on Debug mode, I would like the output to be mylib_d.dll,
and if I'm on Release mode : mylib.dll

I would like also to be able to link with different library depending on the build status.

For example :

When I'm on Debug mode : TARGET_LINK_LIBRARIES(MyLib_d depend_d)
And on the Release mode : TARGET_LINK_LIBRARIES(MyLib depend)





Here is my Cmakelist :

PROJECT(MyLib)


SET(SRCS init.cpp)
SET(HEADS init.h)

ADD_LIBRARY(MyLib SHARED ${SRCS} ${HEADS})

TARGET_LINK_LIBRARIES(MyLib depend)


More information about the CMake mailing list