test if a variable is empty and give default value during qmake
问题 How can you test if a variable is empty or not defined in a qmake .pro file? I want to be able to set up a default value if the variable is not defined. I tried eval("VARIABLE" = ""){ VARIABLE = test } eval("VARIABLE" = ""){ message(variable is empty) } but I still get the message "variable is empty". 回答1: there is already the function isEmpty I didn't spot: isEmpty(VARIABLE){ VARIABLE = test } isEmpty(VARIABLE ){ message(variable is empty) } I don't understand why eval didnt work thought...