aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2020-06-09 12:07:59 +0200
committerCristian Adam <cristian.adam@qt.io>2020-06-09 12:44:29 +0000
commitbe339abb1682a9887d29c5a0fe3746300f52380f (patch)
tree123799d7a9f06e995feced928300a2afeaccc7d4
parent3bd22bd2d7ef756bfcba4e12c7a043444f6b3d1d (diff)
CMake Build: Fix unittests
Change-Id: I4214954d880d19dbe9a070d031c417dc3caf068a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--cmake/QtCreatorAPI.cmake5
-rw-r--r--tests/unit/unittest/CMakeLists.txt11
2 files changed, 13 insertions, 3 deletions
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake
index 4249e718242..1c5dbbcece0 100644
--- a/cmake/QtCreatorAPI.cmake
+++ b/cmake/QtCreatorAPI.cmake
@@ -679,11 +679,14 @@ function(add_qtc_test name)
endif()
endfunction()
-function(finalize_qtc_gtest test_name)
+function(finalize_qtc_gtest test_name exclude_sources_regex)
if (NOT TARGET ${test_name})
return()
endif()
get_target_property(test_sources ${test_name} SOURCES)
+ if (exclude_sources_regex)
+ list(FILTER test_sources EXCLUDE REGEX "${exclude_sources_regex}")
+ endif()
include(GoogleTest)
gtest_add_tests(TARGET ${test_name} SOURCES ${test_sources} TEST_LIST test_list)
diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt
index db6bb6c5911..3fd9c4b7af4 100644
--- a/tests/unit/unittest/CMakeLists.txt
+++ b/tests/unit/unittest/CMakeLists.txt
@@ -20,7 +20,7 @@ add_qtc_test(unittest GTEST
Qt5::Xml Qt5::Concurrent Qt5::Qml Qt5::Gui
Googletest
clangrefactoringbackend_lib clangbackend_lib clangpchmanagerbackend_lib
- CPlusPlus Sqlite Utils
+ CPlusPlus Utils
DEFINES
UNIT_TESTS
DONT_CHECK_MESSAGE_COUNTER
@@ -174,6 +174,13 @@ add_qtc_test(unittest GTEST
sqlitevalue-test.cpp
)
+extend_qtc_test(unittest
+ DEFINES
+ $<TARGET_PROPERTY:Sqlite,INTERFACE_COMPILE_DEFINITIONS>
+ SOURCES
+ ../../../src/libs/3rdparty/sqlite/sqlite3.c
+)
+
# Do not work on the source directory data
add_custom_command(TARGET unittest POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
@@ -289,7 +296,7 @@ extend_qtc_test(unittest
smallstring-benchmark.cpp
)
-finalize_qtc_gtest(unittest)
+finalize_qtc_gtest(unittest ".c$")
# Path needs to be before CppTools
target_include_directories(unittest