aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2017-11-05 09:43:43 +0100
committerDavid Faure <faure@kde.org>2017-11-05 22:32:09 +0200
commitf7707bb546bc2a115b821dd7bcaa1e234e70acbc (patch)
tree148fec3cc272de8260e410e3b8bfc59e00cf4990
parentd5ac6b2455d0d8284b1b6f8d208a104b75ffc43a (diff)
downloadextra-cmake-modules-f7707bb546bc2a115b821dd7bcaa1e234e70acbc.tar.gz
extra-cmake-modules-f7707bb546bc2a115b821dd7bcaa1e234e70acbc.tar.bz2
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
-rw-r--r--modules/ECMAddTests.cmake4
1 files changed, 4 insertions, 0 deletions
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()