From f7707bb546bc2a115b821dd7bcaa1e234e70acbc Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 5 Nov 2017 09:43:43 +0100 Subject: ECMAddTests: set QT_PLUGIN_PATH so locally built plugins can be found Summary: This of course requires running the unittests via ctest rather than launching the executable directly. Test Plan: `ctest -V -R kurifiltertest` in kio, which prints QCoreApplication::libraryPaths() at the beginning of the test. With this commit, builddir/kio/bin is added at the front of the list, and the kurifilter plugins from kio's build are loaded. Reviewers: cgiboudeaux, kfunk Reviewed By: cgiboudeaux Subscribers: #frameworks, #build_system Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D8660 --- modules/ECMAddTests.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake index 96673888..2a992156 100644 --- a/modules/ECMAddTests.cmake +++ b/modules/ECMAddTests.cmake @@ -114,6 +114,10 @@ function(ecm_add_test) add_test(NAME ${_testname} COMMAND ${_targetname}) target_link_libraries(${_targetname} ${ARG_LINK_LIBRARIES}) ecm_mark_as_test(${_targetname}) + if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(_plugin_path $ENV{QT_PLUGIN_PATH}) + set_property(TEST ${_testname} PROPERTY ENVIRONMENT QT_PLUGIN_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:${_plugin_path}) + endif() if (ARG_TARGET_NAME_VAR) set(${ARG_TARGET_NAME_VAR} "${_targetname}" PARENT_SCOPE) endif() -- cgit v1.2.1