From 97e755945c0a95d4c82ef4b1897226b340bd9e82 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 25 Feb 2013 11:26:53 +0100 Subject: [PATCH] Automatically find external dependencies in cmake tests. Currently the Qt5_MODULE_TEST_DEPENDS variable is maintained individually in each repo. This patch makes that obsolete. Change-Id: I1a72bb4da70b9ace6f79296d6a3fb295eaa999ff Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly --- mkspecs/features/ctest_testcase.prf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf index 7f86ca0052..7e841de790 100644 --- a/mkspecs/features/ctest_testcase.prf +++ b/mkspecs/features/ctest_testcase.prf @@ -31,6 +31,8 @@ isEmpty(CMAKE_VERSION) { isEmpty(VERSION_OK) { message("cmake $$CMAKE_VERSION is too old for this test.") } else { + load(cmake_functions) + CMAKE_BUILD_TYPE = Debug CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\" @@ -41,9 +43,13 @@ isEmpty(CMAKE_VERSION) { CMAKE_PREFIX_PATH *= $$dirname(d) } + dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.") + dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST + dependentmodules = $$cmakeModuleList($$dependentmodules) + check.commands = \ $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \ - cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" && \ + cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \ $(TESTRUNNER) ctest --output-on-failure }