[Cmake] Questions about debug and release modes.

Brad King brad.king at kitware.com
Tue Feb 25 15:21:30 EST 2003


> First, how do you choose between debug, release, and other modes using
> make?

Only one build configuration per build tree is supported.  Set
CMAKE_BUILD_TYPE to "Debug", "Release", etc. to change it.

> Also, isn't there some way to generate a makefile or MSW project file
> that can look for different libraries depending on whether Release or
> Debug mode is chosen?  It seems that, when linking to FLTK, this doesn't
> happen since you have to specify in the cache which library files to
> use.  Yet it ought to be possible to generate a make file or project
> file that conditionally chooses between the different options, no?

I don't think there is any support for this in Makefiles right now, but
something along these lines is planned for the future.  For windows you
can do this:

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

This will link target foo to "bar" in unix builds and optimized windows
builds.  For debug windows builds, it will link to "bar_d".

-Brad




More information about the CMake mailing list