Using "build settings" (configuration? target?) to set DEFINEs doesn't work?

  • in my build settings i have this:
    0_1501978635759_Screen Shot 2017-08-05 at 5.12.54 PM.png

    see how i've defined "TARGET" to be the name of the build setting?

    so then in my pro file i have this:
    0_1501978673786_Screen Shot 2017-08-05 at 5.15.16 PM.png

    see how it shows a "message" of the $${TARGET}? that WORKS when i run qmake (it shows correct build setting / target).
    however look a little further down, i want to set a DEFINE based on whether the $$TARGET has the word "Pro" or "2" in it. this is NOT working. see:
    0_1501978785612_Screen Shot 2017-08-05 at 5.15.22 PM.png

    Why doesn't this work? i tried with/without the $$ in the "contains()" call.

    aside: why is the pro file parsed THREE times?

  • Moderators


    Does the '|' work there?
    You may need spaces around the sign.
    Did you try with Pro respectively 2 alone?

  • you can use regex in that spot, so '|' without spaces is fine. but yes i tried just Pro or just 2, same problem.

  • okay so "contains" is not a substring containment test. the test must be for the entire text of the variable. so this worked:

    if (contains(TARGET, "kJams Lite Debug") | contains(TARGET, "kJams Lite")) {
    	message("KJAMS_PRO NOT set :(")
    } else {
    	message("KJAMS_PRO SET! :)")

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.