Results 1 to 1 of 1

Thread: qmake contains() doesn't work

  1. #1
    Join Date
    Jul 2015
    Posts
    52
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qmake contains() doesn't work

    I have this in my .pro:

    Qt Code:
    1. message("Defines: $$DEFINES")
    2. contains(DEFINES, USE_GAMEPAD)
    3. {
    4. message("Building with XInput support")
    5. SOURCES += gamepad.cpp
    6. HEADERS += gamepad.h
    7. }
    To copy to clipboard, switch view to plain text mode 

    Running qmake outputs:
    Qt Code:
    1. Project MESSAGE: Defines: UNICODE WIN32
    2. Project MESSAGE: Building with XInput support
    To copy to clipboard, switch view to plain text mode 

    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:
    Qt Code:
    1. contains(DEFINES, "USE_GAMEPAD=1"):{
    2. message("Building with XInput support")
    3. SOURCES += gamepad.cpp
    4. HEADERS += gamepad.h
    5. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by quimnuss; 7th October 2015 at 14:11.

Similar Threads

  1. QMake for Linux x64 doesn't set -L/usr/lib64
    By PhilippM in forum Newbie
    Replies: 1
    Last Post: 19th April 2011, 14:14
  2. Slot doesn't seem to work
    By waynew in forum Newbie
    Replies: 3
    Last Post: 10th November 2009, 09:54
  3. qmake doesn't respect QMAKESPEC variable
    By piotr.dobrogost in forum Installation and Deployment
    Replies: 5
    Last Post: 19th July 2009, 22:08
  4. qmake: Can't Get DISTFILES to Work
    By tbrowder in forum Qt Programming
    Replies: 8
    Last Post: 24th August 2008, 23:21
  5. qmake -project does not work
    By Caius Aérobus in forum Installation and Deployment
    Replies: 2
    Last Post: 7th February 2008, 17:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.