qt - 测试变量是否为空并在 qmake 期间给出默认值

标签 qt qmake

如何测试 qmake .pro 文件中的变量是否为空或未定义?我想要 如果 undefined variable ,则能够设置默认值。

我试过了

eval("VARIABLE" = ""){
     VARIABLE = test
}

eval("VARIABLE" = ""){
     message(variable is empty)
}

但我仍然收到消息“变量为空”。

最佳答案

已经有函数 isEmpty我没发现:

isEmpty(VARIABLE){
  VARIABLE = test
}    
isEmpty(VARIABLE ){
  message(variable is empty)
}

我不明白为什么 eval 不起作用……

关于qt - 测试变量是否为空并在 qmake 期间给出默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13803893/

相关文章:

qt - 从 Qt 5.3 代码中的任何位置获取 QML 根对象

c++ - Qt, "convert project to qmake generated project"在Visual Studio中做什么

QT-Creator:我应该在哪里看到 qMake 变量的输出: "message( string )"

c++ - 使用 QImage 填充 QListWidget

c++ - 发射信号不正常

c++ - 存储有关 View 中项目的持久信息

qt - 如何配置 qmake 以便我的应用程序安装为 "make install"?

linux - 如何让 Nvidia 的 PhysX 3.3 在 Linux 中链接?

Android Hello World Qt 5.2

c++ - 如何编译qtconnectivity(蓝牙)?