[Development] Proposing CMake as build tool for Qt 6

Sérgio Martins sergio.martins at kdab.com
Sat Jun 15 12:06:08 CEST 2019

On 2019-06-15 07:45, Bogdan Vatra via Development wrote:
> Hi,
> În ziua de joi, 13 iunie 2019, la 18:22:14 EEST, Thiago Macieira a 
> scris:
>> On Thursday, 13 June 2019 01:06:06 PDT Bogdan Vatra via Development 
>> wrote:
>> > Hi,
>> >
>> >   There is one more missing feature to add to your list: build & debug
>> >
>> > builds for msvc in one go (same as qmake does now, a single "make" command
>> > will build both targets).
>> I wouldn't call that a hard requirement. Separate builds for debug and 
>> for
>> release are acceptable, the same way that we've ostensibly had support 
>> for
>> shared-and-release builds but in practice they're always built 
>> separately.
>> The only difficult part I see is enforcing the suffix. On Mac we've 
>> had
>> problems with this, since a debug-only build is un-suffixed. Maybe 
>> it's time
>> to rethink the strategy and make the suffix optional altogether (using 
>> the
>> lib infix feature). On Windows, we should stop enforcing that 
>> unoptimised
>> builds be -MDd and make it easy for people to debug into -MD 
>> libraries.
>> Hardly anyone ever debugs into Microsoft's libraries...
> I think libs built with -MDd are a must to enable debug builds for your
> application. AFAIK (if I'm wrong I apologize) you can't mix debug apps 
> with
> release libs.
> So, as long as we need to provide libs, (qml) plugins  for debug & 
> release I
> think building them in one go is a must have feature.

Depends what you mean by "debug build".

The current definition of "debug" for MSVC Qt is:
1) Unoptimized  (via /O flags)
2) Has debug symbols
3) Links to another c++ runtime library, which lets you debug into 
(/MDd). (And this is what prevents you from mixing release Qt with debug 

The idea above would be to drop 3). On linux you don't link to a debug 
libstdc++ either and you don't complain :)

But there might be problems:

- cmake -DCMAKE_BUILD_TYPE=Debug means /MDd ?
- The _DEBUG macro currently comes from /MDd, some users might be using 
it to detect debug builds.
- MDd is useful to enable asserts in the C++ library. This argument is 
strong on Windows, as you don't have valgrind there (or at least an 
equivalent that doesn't suck too much).

Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts

More information about the Development mailing list