[CMake] Debug and Release build from a make option
Nils Gladitz
nilsgladitz at gmail.com
Thu Aug 21 07:39:16 EDT 2014
On 21.08.2014 13:27, Mauro Ziliani wrote:
> Hi all.
> I came from bakefile 0.2.9 generator.
> In my projects I defined the default build type as debug.
>
> So when I run
>
> make
>
> my project will build in debug mode.
>
> When I need to produce the final executable i have to run
>
> make BUILD=release
>
> and I'll get the final release executable.
>
> How can I achieve the same behavious in CMake (3.0)?
CMake has multi- (e.g. Visual Studio, XCode) and single-configuration
(e.g. Makefile, Ninja) generators.
With multi-configuration generators you pick the build type at build
time (build tool invocation).
With single-configuration generators you pick the build type at
configuration time (cmake invocation).
Assuming one of the single-configuration Makefile generators you tell
cmake about the build type with e.g.
-DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=Release.
I would maintain one out of source tree build directory per
configuration of interest.
Nils
More information about the CMake
mailing list