[Cmake] Adding suffixes to debug/release builds

Bill Hoffman bill.hoffman@kitware.com
Wed, 29 Jan 2003 12:35:18 -0500


That you can do like this:

IF(WIN32)
  TARGET_LINK_LIBRARIES(foo debug barD)
  TARGET_LINK_LIBRARIES(foo optimized bar)
ELSE(WIN32)
  TARGET_LINK_LIBRARIES(foo  bar)
ENDIF(WIN32)

-Bill


At 06:21 PM 1/29/2003 +0100, NTR wrote:
>Hi again,
>
>how about when one wants to link the four different libraries generated by
>CMake to Debug or Release libraries accordingly e.g. "foo" has the four
>libraries something like:
>foo - Win32 MinSizeRel" (based on "Win32 (x86) Static Library")          -
>links to bar.lib
>foo - Win32 Release" (based on "Win32 (x86) Static Library")               -
>links to bar.lib
>foo - Win32 RelWithDebInfo" (based on "Win32 (x86) Static Library")  - links
>to barD.lib
>foo - Win32 Debug" (based on "Win32 (x86) Static Library")                 -
>links to barD.lib
>
>Regards,
>Niels
>
>
>----- Original Message -----
>From: "Bill Hoffman" <bill.hoffman@kitware.com>
>To: "NTR" <niels_tr@hotmail.com>; <cmake@public.kitware.com>
>Sent: Wednesday, January 29, 2003 5:56 PM
>Subject: Re: [Cmake] Adding suffixes to debug/release builds
>
>
>> This is Partially done in CMake 1.6.  It only works for the Visual Studio
>7 generator.   It is a bit tricky to implement, and that is why it has not
>yet been completely done.
>> Perhaps the next version.
>>
>> -Bill
>>
>>
>> At 05:50 PM 1/29/2003 +0100, NTR wrote:
>> >Hi,
>> >
>> >this is a question that has been asked before, but I couldn't find the
>> >answer.
>> >
>> >---
>> >it is good practice with libraries built with MSVC to give different
>builds
>> >of the same library different filename suffixes. This eliminates the
>> >possibility that the linker incorrectly finds and uses a wrong version of
>> >the library. For example, the release build of the (well-known) MFC
>library
>> >normally is named MFC42.DLL, but the debug build spells MFC42D.DLL.
>> >Furthermore, the Unicode version of MFC has the name MFC42U.DLL, and the
>> >debug build of the unicode version is named MFC42UD.DLL.
>> >
>> >Is it possible to do this with CMake automatically? If not, would it be a
>> >big hack to include this? (So far, I'm not familiar with the CMake source
>> >tree.)
>> >
>> >For some projects, other suffixes could be necessary (just imagine
>> >graphlib_mmx.dll, graphlib_3dnow.dll, etc.)...
>> >---
>> >
>> >I guess this could be partially solved by changing the dsp templates.
>> >However, it would be nice if a cross-platform solution existed so
>libraries
>> >would have consistent naming.
>> >
>> >Regards,
>> >Niels
>> >
>> >PS: The result could be something like for "foo" library
>> >foo.lib
>> >food.lib
>> >foo.dll
>> >food.dll
>> >etc.
>> >_______________________________________________
>> >Cmake mailing list
>> >Cmake@public.kitware.com
>> >http://public.kitware.com/mailman/listinfo/cmake
>>
>_______________________________________________
>Cmake mailing list
>Cmake@public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake