[CMake] nmake build with different options at command line

David Cole david.cole at kitware.com
Fri Feb 19 13:12:07 EST 2010


You cannot do the same thing with nmake. You must do it with cmake.

If you want to build multiple configurations in the same build tree, you
must use the Visual Studio or Xcode generators. The nmake and other Makefile
generators only support ONE CMAKE_BUILD_TYPE in a given build tree.

The way to do it with nmake is to have two separate build trees. One for
Release and one for Debug. Then, in each of those directories, you may
simply run "nmake". Switch from one directory to the other to change
configurations with a make file generator.


HTH,
David


On Fri, Feb 19, 2010 at 12:50 PM, Chauhan, Vikas
<vikas.chauhan at anritsu.com>wrote:

> My question has been stated in this post before, but I will repeat here
> for convenience:
> We have a way to build desired configuration using cmake (independent of
> what is present as default in cmakecache.txt):
> cmd> cmake --build .. --config= Release
>
> I can choose different build config here at build time NOT at build
> generation time (and is independent of what is present in
> cmakecache.txt).
>
> However, this is with cmake. My question is that how do I do the same
> thing with nmake?
>
> Thanks,
> Vikas
>
> > -----Original Message-----
> > From: Tyler Roscoe [mailto:tyler at cryptio.net]
> > Sent: 19 February 2010 16:09
> > To: Chauhan, Vikas
> > Cc: cmake at cmake.org; Bill Hoffman
> > Subject: Re: [CMake] nmake build with different options at command
> line
> >
> > On Fri, Feb 19, 2010 at 08:03:59AM -0800, Tyler Roscoe wrote:
> > > On Fri, Feb 19, 2010 at 11:19:18AM -0000, Chauhan, Vikas wrote:
> > > > Thanks but what is the option when we use nmake to build?
> > >
> > > I don't understand your question.
> >
> > Ok I'll take a stab.
> >
> > Since CMAKE_BUILD_TYPE is a cache variable, you only have to specify
> the
> > -D flag once, when running cmake and populating your build directory
> for
> > the first time. Subsequent builds (make) will use this
> previously-cached
> > CMAKE_BUILD_TYPE and all your builds with that build directory will be
> > release builds.
> >
> > tyler
> >
> > > > > -----Original Message-----
> > > > > From: Tyler Roscoe [mailto:tyler at cryptio.net]
> > > > > Sent: 18 February 2010 17:09
> > > > > To: Chauhan, Vikas
> > > > > Cc: Bill Hoffman; cmake at cmake.org
> > > > > Subject: Re: [CMake] nmake build with different options at
> command
> > > > line
> > > > >
> > > > > On Thu, Feb 18, 2010 at 05:07:37PM -0000, Chauhan, Vikas wrote:
> > > > > > Thanks but is it possible from command line.
> > > > >
> > > > > cmake -DCMAKE_BUILD_TYPE=release ...
> > > > >
> > > > > (I'm pretty sure -D args have to come before other arguments to
> > > > cmake.)
> > > > >
> > > > > tyler
> > > _______________________________________________
> > > Powered by www.kitware.com
> > >
> > > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > >
> > > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> > >
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.cmake.org/mailman/listinfo/cmake
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100219/93e2026d/attachment.htm>


More information about the CMake mailing list