AW: [Cmake] CMake 1.8.2: Visual Studio 6 library postfix

Stefan Kowski stefan.kowski at gmx.de
Mon, 2 Feb 2004 16:22:14 +0100


Hi,

> > I posted a question for library naming with VS6 last week, but I assume
> > there is no solution for my problem. Therefore a suggestion: is
> it possible
> > to extend the ADD_LIBRARY() command to accept different names for the
> > target?
> >
> > Example: ADD_LIBRARY(debug TestLibd optimized TestLib SHARED <...>)
> >
> > This different names can then be used to generate the .dsp files.
>
> A what about definition special variable called for example "DEBUG_FLAG"
>
> SET(DEBUG_FLAG "d") ... define only in the case of debug version
>
> ADD_LIBRARY(TestLib${DEBUG_FLAG} SHARED <...>)

I already do this for the NMake generator, e.g.

IF(WIN32)
   IF(CMAKE_BUILD_TYPE MATCHES "Debug")
      SET(PPVM_LIB_SUFFIX "sd")
      SET(PPVM_DLL_SUFFIX "d")
   ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
      SET(PPVM_LIB_SUFFIX "s")
      SET(PPVM_DLL_SUFFIX "")
   ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
ELSE(WIN32)
   SET(PPVM_LIB_SUFFIX "")
   SET(PPVM_DLL_SUFFIX "")
ENDIF(WIN32)

SET(TARGET_TESTLIB TestLib${PPVM_LIB_SUFFIX})
ADD_LIBRARY(${TARGET_TESTLIB} source/TestLib.cpp)

but unfortunately I cannot do this if I generate Visual Studio .dsp files.
The .dsp generator does not have the build type available so the names of
the Debug, Release, RelWithDebug etc. targets are always the same.

Greetings,
Stefan