Using "build settings" (configuration? target?) to set DEFINEs doesn't work?
-
in my build settings i have this:
see how i've defined "TARGET" to be the name of the build setting?
so then in my pro file i have this:
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:
Why doesn't this work? i tried with/without the $$ in the "contains()" call.
aside: why is the pro file parsed THREE times?
-
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! :)") DEFINES += KJAMS_PRO }
-
in my build settings i have this:
see how i've defined "TARGET" to be the name of the build setting?
so then in my pro file i have this:
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:
Why doesn't this work? i tried with/without the $$ in the "contains()" call.
aside: why is the pro file parsed THREE times?
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! :)") DEFINES += KJAMS_PRO }