diff options
author | Christian Stenger <christian.stenger@qt.io> | 2021-09-10 11:12:20 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2021-09-13 08:54:48 +0000 |
commit | f6f2ffde4e4c49834266210d8f9778660fca28f9 (patch) | |
tree | 8bc905f7c1261d9c2f79286b6b7c72d3e1f418e8 /share/qtcreator/templates/wizards/autotest/files/tst.txt | |
parent | 9d1cb4211abc54dc0eccafe5e41df8bbf9b95a3f (diff) |
AutoTest: Fix generated files for gtest
When using gtest as test framework the wizard generated
a header file containing the test code which had been
included inside the main.
As this works generally it is on the one hand not
recommended and on the other hand it lets us fail when
using cmake as build system.
Create a cpp file instead and use this accordingly.
Fixes: QTCREATORBUG-26253
Change-Id: Ibec8489258de0def27ee116eacbfc1bb22d3206b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'share/qtcreator/templates/wizards/autotest/files/tst.txt')
-rw-r--r-- | share/qtcreator/templates/wizards/autotest/files/tst.txt | 4 |
1 files changed, 3 insertions, 1 deletions
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) |