How to include disinfectants in QMake?

How to enable the use of disinfectants in QMake .pro files?

I found several ressources that modify QMAKE_CXXFLAGS themselves, but the introductory blog post says:

It is planned for the dev branch (Qt 5.2) because it is a new feature, but you must be perfectly cherry to select it, for example. Qt 5.0. You can then configure Qt with the -address sanitizer and run qmake CONFIG + = address_sanitizer for your own applications.

However, adding CONFIG+=address_sanitizer does not seem to have an effect.

+5
source share
1 answer

The sanitizer parameters are defined in Qt mkspecs ( mkspecs/features/sanitizer.prf and mkspecs/common/sanitize.conf ). A quick look at my sanitizer.prf (Qt 5.7.0) shows that the correct CONFIG flags are:

  • sanitize_address
  • sanitize_memory
  • sanitize_thread
  • sanitize_undefined

This means that to include, for example, a disinfectant, you must write:

 CONFIG += sanitizer sanitize_address 
+5
source

All Articles