Solved isEmpty() does not work with a variable
-
Hi, I have a file
lib_template.pri
isEmpty(NAME) { error(NAME must be set before including the file) } TEMPLATE = lib CONFIG += static TARGET = $$NAME INCLUDEPATH += \ $$PWD \
it is supposed to be used in the manner
NAME = lib_name include($$qmake_scripts_dir/lib_template.pri)
isEmpty(...)
always shows error as ifNAME
never defined
What is the problem? -
Hi
QMake scope rules is a bit surprising at times.try the test as
isEmpty(NAME) { error(NAME must be set before including the file) }
(as a one liner ) -
@mrjj at least the opening brace needs to be on the same line ;)
-
@aha_1980
yeah, i regularly forget that - as they cleverly made it look like a normal scope { }
but with the twist that first { must be on the same line. 😂 -
thank you. However it is not intuitive for C++ programmer....