<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
What you need to do is to make a list of both libraries and store that in a variable with some "extras"<div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Monaco" size="3" color="#000080" style="font: 11.0px Monaco; color: #000080">SET</font><font face="Monaco" size="3" style="font: 11.0px Monaco">(</font><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 12px; ">MYLIB</span>_LIBRARIES optimized </font><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 12px; ">mylib</span> debug </font><font face="Monaco" size="3" style="font: 11.0px Monaco"><span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 12px; ">mylibd</span>)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;">Then, <span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 12px; ">TARGET_LINK_LIBRARIES(MY_EXE ${<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 12px; ">MYLIB</span>_LIBRARIES</span>})</span></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">VS should do the right thing.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Mike</div></div><div><br><div><div>On Jan 23, 2008, at 3:09 PM, Sylvain Jaume wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Eric,<br><br>It doesn't work because CMAKE_BUILD_TYPE is not defined at configuration time for Visual Studio.<br><br>Thanks anyway.<br>Sylvain<br><br><div class="gmail_quote">On Jan 23, 2008 2:27 PM, Eric Noulard &lt; <a href="mailto:eric.noulard@gmail.com" target="_blank">eric.noulard@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> 2008/1/23, Sylvain Jaume &lt;<a href="mailto:sylvainjaume@gmail.com" target="_blank">sylvainjaume@gmail.com</a>&gt;:<br><div>&gt; Hi,<br>&gt;<br>&gt; How can I link to mylib.dll in Release and mylibd.dll in Debug?<br>&gt; I use VS8 and both libraries are in the same directory. <br><br></div>I don't if it would work for VS8 but I would try:<br><br>IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")<br>   SET(MYLIB "mylibd")<br>ELSE("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") <br>   SET(MYLIB "mylib")<br>ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")<br><br>TARGET_LINK_LIBRARIES(MY_EXE ${MYLIB})<br><font color="#888888"><br>--<br>Erk<br><br></font></blockquote></div></blockquote></div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Bitstream Vera Sans; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><br class="Apple-interchange-newline"></span> </div><br></div></body></html>