[CMake] linking to different libraries in Debug and Release

Eric Noulard eric.noulard at gmail.com
Wed Jan 23 14:27:40 EST 2008


2008/1/23, Sylvain Jaume <sylvainjaume at gmail.com>:
> Hi,
>
> How can I link to mylib.dll in Release and mylibd.dll in Debug?
> I use VS8 and both libraries are in the same directory.

I don't if it would work for VS8 but I would try:

IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
   SET(MYLIB "mylibd")
ELSE("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
   SET(MYLIB "mylib")
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")

TARGET_LINK_LIBRARIES(MY_EXE ${MYLIB})

-- 
Erk


More information about the CMake mailing list