[CMake] Detect build type
Filipe Sousa
natros at gmail.com
Fri Apr 22 05:29:05 EDT 2005
On Thursday 21 April 2005 18:00, Brad King wrote:
> Filipe Sousa wrote:
> > Is there a better way to know if CMake is generating files for debug or
> > release builds than using CMAKE_BUILD_TYPE?
> >
> > I've been using this:
> > IF(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
> > SET(CMAKE_DEBUG_MODE 1)
> > ENDIF(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
> >
> > IF(CMAKE_BUILD_TYPE MATCHES "[Re][Ee][Ll][Ee][Aa][Ss][Ee]")
> > SET(CMAKE_RELEASE_MODE 1)
> > ENDIF(CMAKE_BUILD_TYPE MATCHES "[Re][Ee][Ll][Ee][Aa][Ss][Ee]")
>
> Code like this will work only for the makefile generators. Project file
> generators usually produce all configurations in the same build tree and
> it is up to the user at build-time to select the desired build type.
> This information is not available at cmake-time.
>
> What kind of configuration do you do based on the build type? There is
> probably a way to convert this to build-time so that it will work for
> all generators.
>
> -Brad
I'm using it for two things: First, I need to control CMAKE_SKIP_RPATH, I
don't want rpath in release mode. Second, my application needs to know where
to find some resources in the source tree when I'm in the development mode
(that's when I set CMAKE_BUILD_TYPE to Debug), in the release mode the
application is able to find the resources in the installation directory.
Depending on the build type, cmake generates two different files called
PathResolver.cc that knows where to find the application resources.
How does cmake knows when to use CMAKE_CXX_FLAGS_DEBUG or
CMAKE_CXX_FLAGS_RELEASE?
-- Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050422/a267a074/attachment.pgp
More information about the CMake
mailing list