diff options
Diffstat (limited to 'share/qtcreator/templates/wizards/autotest/files/tst.qbs')
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst.qbs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.qbs b/share/qtcreator/templates/wizards/autotest/files/tst.qbs index 1000451bc6..58a647df86 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.qbs +++ b/share/qtcreator/templates/wizards/autotest/files/tst.qbs @@ -1,6 +1,7 @@ import qbs @if "%{TestFrameWork}" == "GTest" -import "../googlecommon.js" as googleCommon +import qbs.Environment +import "googlecommon.js" as googleCommon @endif CppApplication { @@ -16,6 +17,19 @@ CppApplication { ] @else consoleApplication: true + +@if "%{TestFrameWork}" == "GTest" + property string googletestDir: { + if (typeof Environment.getEnv("GOOGLETEST_DIR") === 'undefined') { + console.warn("Using googletest src dir specified at Qt Creator wizard") + console.log("set GOOGLETEST_DIR as environment variable or Qbs property to get rid of this message") + return "%{GTestRepository}" + } else { + return Environment.getEnv("GOOGLETEST_DIR") + } + } +@endif + @if "%{GTestCXX11}" == "true" cpp.cxxLanguageVersion: "c++11" cpp.defines: [ "GTEST_LANG_CXX11" ] @@ -23,13 +37,13 @@ CppApplication { cpp.dynamicLibraries: [ "pthread" ] - cpp.includePaths: [].concat(googleCommon.getGTestIncludes(project.googletestDir)) - .concat(googleCommon.getGMockIncludes(project.googletestDir)) + cpp.includePaths: [].concat(googleCommon.getGTestIncludes(googletestDir)) + .concat(googleCommon.getGMockIncludes(googletestDir)) files: [ "%{MainCppName}", "%{TestCaseFileWithHeaderSuffix}", - ].concat(googleCommon.getGTestAll(project.googletestDir)) - .concat(googleCommon.getGMockAll(project.googletestDir)) + ].concat(googleCommon.getGTestAll(googletestDir)) + .concat(googleCommon.getGMockAll(googletestDir)) @endif } |