[Interest] qmake: Test if environment variable is set.
Carel Combrink
carel.combrink at gmail.com
Wed May 27 09:03:24 CEST 2015
Hi,
How do one test if an environmental variable is set from qmake?
I have searched a lot but can't get the code working. People and
documentation point to isEmpty() but that does not achieve the correct
result, see below:
My Code in my pro file:
isEmpty(TEST_1) {
message(Test 1: Empty ($$TEST_1))
} else {
message(Test 1: Not empty ($$TEST_1))
}
TEST_2=1
isEmpty(TEST_2) {
message(Test 2: Empty ($$TEST_2))
} else {
message(Test 2: Not empty ($$TEST_2))
}
TEST_3=$(FOO)
isEmpty(TEST_3) {
message(Test 3: Empty ($$TEST_3))
} else {
message(Test 3: Not empty ($$TEST_3))
}
TEST_4=$(PATH)
isEmpty(TEST_4) {
message(Test 4: Empty ($$TEST_4))
} else {
message(Test 4: Not empty ($$TEST_4))
}
TEST_5=
isEmpty(TEST_5) {
message(Test 5: Empty ($$TEST_5))
} else {
message(Test 5: Not empty ($$TEST_5))
}
And the output is:
Project MESSAGE: Test 1: Empty ()
Project MESSAGE: Test 2: Not empty (1)
Project MESSAGE: Test 3: Not empty ()
Project MESSAGE: Test 4: Not empty (/my/actual/path/)
Project MESSAGE: Test 5: Empty ()
So from this one can see that Test 3 does not give the required result.
Am I doing something wrong?
Is this intended behaviour?
How can I proceed to get the correct result?
Qt: 5.3.2
OS: Ubuntu 14.04 x64
Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150527/0f4b8008/attachment.html>
More information about the Interest
mailing list