[CMake] Annoyances with cmake vs qmake

Eric Noulard eric.noulard at gmail.com
Sun Mar 28 16:23:54 EDT 2010


2010/3/28 Ruben Van Boxem <vanboxem.ruben at gmail.com>:
Hi Ruben,

> 2) A second point, and this has been brought up before on this list, several
> times even. With qmake:
> qmake
> make debug //produces debug binaries
> make release //produces release binaries
> make all //produces both
> make distclean //cleans out *most* of the qmake generated files

As you may have read, the multi-config in the same generator
is supported by some generator (like the Visual Studio one) which
have this "builtin" and concerning the Makefile generator
you can easily reproduce what you want with a simple script which would do

mkdir build_debug
cd build_debug
cmake -DCMAKE_BUILD_TYPE=Debug /path/to/source
make
cd ..
mkdir build_release
cd build_release
cmake -DCMAKE_BUILD_TYPE=Release /path/to/source
cd ..

concerning make clean the following is even cleaner:

rm -rf build_debug
rm -rf build_release


Concerning the default value for CFLAGS in "Release"
I didn't realize the default CMake choice was different from other
and I let CMake developer explain why.

In the meantime you may define your own "MyRelease" type
of build. see http://www.itk.org/Wiki/CMake_Useful_Variables
--> CMAKE_BUILD_TYPE.

> It shouldn't be hard to have each target's build dir have a debug and
> release folder (even if it's only for windows stuff), and add the de facto
> standard debug suffix d to the debug binaries. Even easier would be to have
> all debug object files have the d suffix, eliminating the need for release
> and debug directory clobber.

Having a separate build dir for debug and release doesn't mean you can't mangle
the postfix of your lib. In fact you just have to add to your CMakeLists.txt

SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "debug library postfix,
usually d on windows")

and library generated for "DEBUG" build type will have the extra "d".

> Additionally, the distclean target is pretty handy, but I've seen enough
> argumentation (out-of-source builds) that convinces me it's not the CMake
> way

I think you get that one already.

> So something like this would be AWESOME:
> mkdir build
> cd build
> cmake ..
> make debug //produce debug binaries
> make release //produce release binaries
> make all //produce both
>
> A simple debug suffix will solve most problems with this I believe, and
> seems to me, extremely handy for the windows platform. Then MinGW or Nmake
> makefiles will be a standalone thing, like vcproj files, where it is
> perfectly possible.


Now after all what you said, I would be tempted by a multiconfig single build
mainly because I'd like for example to package **BOTH** build with CPack
in a single package and this is currently not possible out of the box.

> On a sidenote, CMake is very powerful and solid tool, and I'm really
> starting to hate the whole configure script and libtool hell. Thanks

Welcome to a new Hell :-] ... just kidding.
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list