PDA

View Full Version : qmake contains() doesn't work



quimnuss
7th October 2015, 14:11
I have this in my .pro:


message("Defines: $$DEFINES")
contains(DEFINES, USE_GAMEPAD)
{
message("Building with XInput support")
SOURCES += gamepad.cpp
HEADERS += gamepad.h
}

Running qmake outputs:

Project MESSAGE: Defines: UNICODE WIN32
Project MESSAGE: Building with XInput support

USE_GAMEPAD is clearly not in the DEFINES and yet, it enters the scope. What am I doing wrong?

Added after 1 4 minutes:

Here's the correct syntax:


contains(DEFINES, "USE_GAMEPAD=1"):{
message("Building with XInput support")
SOURCES += gamepad.cpp
HEADERS += gamepad.h
}


The reason the previous wasn't working is either because of the missing semicolon or because USE_GAMEPAD was not defined so I guess it was checking contains(DEFINES, "") or something like that.