gpt4 book ai didi

qt - 如何检测当前项目是应用程序、共享库还是qmake中的动态库?

转载 作者:行者123 更新时间:2023-12-04 10:53:10 25 4
gpt4 key购买 nike

我有一个 .pri 文件,它可以包含在库项目和应用程序项目中。其中的一些细节取决于当前的构建类型(lib 或 app)。

检测当前项目是可执行文件、静态库还是动态库的推荐方法是什么?

最佳答案

What is the recommended way to detect if the current project is either an executable, a static library or a dynamic library?



捆绑的脚本会检查 TEMPLATECONFIG变量。以下是执行此类测试的示例代码:
defineReplace(projectType) {
contains(TEMPLATE, ".*lib") {
CONFIG(shared, static|shared): return("dynlib")
return("lib")
}
contains(TEMPLATE, ".*app"): return("app")
return("other")
}

# example usage
prj = $$projectType()
equals(prj, "app"): message("Building the application")
else: message("Doing something different")

关于qt - 如何检测当前项目是应用程序、共享库还是qmake中的动态库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59368841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com