[CMake] Annoyances with cmake vs qmake

Hendrik Sattler post at hendrik-sattler.de
Sun Mar 28 17:17:44 EDT 2010


Am Sonntag 28 März 2010 21:06:10 schrieb Ruben Van Boxem:
> Since qmake is pretty mouldy (I mean, not probable to be updated anytime
> soon with new functionality), I decided to try cmake and its colourful
>  build process.

But if you ever want to leave the very narrow path of what qmake is supposed 
to do, you are virtually doomed :-(

> When experimenting with qmake, I "ported" libogg, libvorbis and libflac to
>  a qmake build system and it worked pretty easily, without many hiccups.
>  Mind you, I didn't add any assembly stuff to the builds, just source and
>  build options. And that brings me to my first point
> 
> 1) in qmake and any other configure-based  build system, the release build
> options for gcc/g++ are something like this: "-O2 -s". CMake uses "-O3".
> This is neither standard nor recommended (see gcc docs, this option might
> even produce slower code). It also forgets to strip the binary target,
>  which makes you end up with larger binaries. This should be changed, as
>  "-O2 -s" for release builds is pretty much the de facto standard.

"gcc -s" is only convenient for e.g. qmake because it only has one install 
target. In cmake, you have "make install" and "make install/strip", so you can 
decide at a later point. And even later, you can always use strip directly to 
achieve exactly the same. Choosing -O2 would really be preferred, but you may 
as well argue for -Os or anything else. You should always set the preferred 
thing yourself, see (C|CPP|CXX|LD)FLAGS environment variables.

> 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.

No, because when compiling differently for Debug and Release, you have all 
object files twice. Thus you would enforce one more level of subfolders even 
for those that only want one setup.
There may be a new Generator that does that but it still has to be written ;)

HS


More information about the CMake mailing list