What you need to do is to make a list of both libraries and store that in a variable with some "extras"

SET(MYLIB_LIBRARIES optimized mylib debug mylibd)

Then, TARGET_LINK_LIBRARIES(MY_EXE ${MYLIB_LIBRARIES})

VS should do the right thing.

Mike

On Jan 23, 2008, at 3:09 PM, Sylvain Jaume wrote:

Hi Eric,

It doesn't work because CMAKE_BUILD_TYPE is not defined at configuration time for Visual Studio.

Thanks anyway.
Sylvain

On Jan 23, 2008 2:27 PM, Eric Noulard < [EMAIL PROTECTED]> wrote:
2008/1/23, Sylvain Jaume <[EMAIL PROTECTED]>:
> 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




_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to