diff options
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst.pro | 6 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst.qbs | 2 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst.txt | 4 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst_main.cpp | 1 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst_src_gt.cpp (renamed from share/qtcreator/templates/wizards/autotest/files/tst_src.h) | 9 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/wizard.json | 8 |
6 files changed, 10 insertions, 20 deletions
diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.pro b/share/qtcreator/templates/wizards/autotest/files/tst.pro index a92e58f06eb..87e6159c462 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.pro +++ b/share/qtcreator/templates/wizards/autotest/files/tst.pro @@ -38,11 +38,9 @@ CONFIG -= app_bundle CONFIG += thread CONFIG -= qt -HEADERS += \\ - %{TestCaseFileWithHeaderSuffix} - SOURCES += \\ - %{MainCppName} + %{MainCppName} \ + %{TestCaseFileGTestWithCppSuffix} @endif @if "%{TestFrameWork}" == "BoostTest" TEMPLATE = app diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.qbs b/share/qtcreator/templates/wizards/autotest/files/tst.qbs index a33cecd5990..26876461540 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.qbs +++ b/share/qtcreator/templates/wizards/autotest/files/tst.qbs @@ -60,7 +60,7 @@ CppApplication { files: [ "%{MainCppName}", - "%{TestCaseFileWithHeaderSuffix}", + "%{TestCaseFileGTestWithCppSuffix}", ].concat(googleCommon.getGTestAll(qbs, googletestDir)) .concat(googleCommon.getGMockAll(qbs, googletestDir)) @endif diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.txt b/share/qtcreator/templates/wizards/autotest/files/tst.txt index fe8e30e789d..516567cc633 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.txt +++ b/share/qtcreator/templates/wizards/autotest/files/tst.txt @@ -57,6 +57,8 @@ target_link_libraries(%{TestCaseName} PRIVATE Qt${QT_VERSION_MAJOR}::QuickTest) @if "%{TestFrameWork}" == "GTest" @if "%{GTestCXX11}" == "true" +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) add_definitions(-DGTEST_LANGUAGE_CXX11) @endif @@ -92,7 +94,7 @@ endif () include_directories(${GTestIncludes}) -add_executable(%{TestCaseName} %{MainCppName} %{TestCaseFileWithHeaderSuffix} +add_executable(%{TestCaseName} %{MainCppName} %{TestCaseFileGTestWithCppSuffix} ${GTestFiles}) add_test(NAME %{TestCaseName} COMMAND %{TestCaseName}) target_link_libraries(%{TestCaseName} PRIVATE Threads::Threads) diff --git a/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp b/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp index e4f33d27164..2d12cccea15 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp +++ b/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp @@ -5,7 +5,6 @@ QUICK_TEST_MAIN(example) @endif @if "%{TestFrameWork}" == "GTest" %{Cpp:LicenseTemplate}\ -#include "%{TestCaseFileWithHeaderSuffix}" #include <gtest/gtest.h> diff --git a/share/qtcreator/templates/wizards/autotest/files/tst_src.h b/share/qtcreator/templates/wizards/autotest/files/tst_src_gt.cpp index ef29240cd5e..749ff06f0ac 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst_src.h +++ b/share/qtcreator/templates/wizards/autotest/files/tst_src_gt.cpp @@ -1,10 +1,4 @@ %{Cpp:LicenseTemplate}\ -@if '%{Cpp:PragmaOnce}' -#pragma once -@else -#ifndef %{GUARD} -#define %{GUARD} -@endif #include <gtest/gtest.h> #include <gmock/gmock-matchers.h> @@ -17,6 +11,3 @@ TEST(%{TestSuiteName}, %{TestCaseName}) ASSERT_THAT(0, Eq(0)); } -@if ! '%{Cpp:PragmaOnce}' -#endif // %{GUARD} -@endif diff --git a/share/qtcreator/templates/wizards/autotest/wizard.json b/share/qtcreator/templates/wizards/autotest/wizard.json index 1ba0101a092..8f32cec145c 100644 --- a/share/qtcreator/templates/wizards/autotest/wizard.json +++ b/share/qtcreator/templates/wizards/autotest/wizard.json @@ -33,8 +33,8 @@ "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }" }, { - "key": "TestCaseFileWithHeaderSuffix", - "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++hdr') }" + "key": "TestCaseFileGTestWithCppSuffix", + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++src') }" }, { "key": "GUARD", @@ -276,8 +276,8 @@ "openAsProject": true }, { - "source": "files/tst_src.h", - "target": "%{TestCaseFileWithHeaderSuffix}", + "source": "files/tst_src_gt.cpp", + "target": "%{TestCaseFileGTestWithCppSuffix}", "condition": "%{JS: value('TestFrameWork') == 'GTest'}", "openInEditor": true }, |