我尝试将现有项目从 qmake 移动到 qbs,到目前为止一切正常,但我无法在 MacOS 上链接到该项目中的谷歌测试静态库,而在 Windows 上它工作正常。
在 MacOS 上我得到:-1: error: symbol(s) not found for architecture x86_64
googletest.qbs:
import qbs
StaticLibrary {
name: "GoogleTest"
files: [
"googletest/googletest/src/gtest-all.cc",
"googletest/googlemock/src/gmock-all.cc"
]
cpp.includePaths: [
"googletest/googletest/include",
"googletest/googlemock/include",
"googletest/googletest",
"googletest/googlemock"
]
Depends { name: "cpp" }
Export {
Depends { name: "cpp" }
cpp.includePaths: [
"googletest/googletest/include",
"googletest/googlemock/include"
]
}
}
测试.qbs:
import qbs
QtApplication {
name: "Test"
targetName: "Test"
Depends { name: "Qt"; submodules: ["core","testlib"]; versionAtLeast: "5.6" }
Depends { name: "GoogleTest"}
cpp.cxxLanguageVersion: "c++11"
consoleApplication: true
files: [
"QtTypePrinters.h",
"main.cpp",
"QStringTest.cpp"
]
}