diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-12-19 12:35:52 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-12-19 12:53:01 +0200 |
commit | b66c9f3c35aeb76143e754808006b40f0bf7f423 (patch) | |
tree | 58a338fcc00031081000a09fa83662320d028674 | |
parent | 1cfcd2a36035f962a27ab0a431355f302008ad0d (diff) | |
download | extra-cmake-modules-b66c9f3c35aeb76143e754808006b40f0bf7f423.tar.gz extra-cmake-modules-b66c9f3c35aeb76143e754808006b40f0bf7f423.tar.bz2 |
Fix QT_PLUGIN_PATH for unittests
It was missing the "/plugins" suffix; found while building KIO with Qt6,
where many unittests were failing with "couldn't create slave" for all slaves;
the kio slaves are in builddir/bin/plugins/kf5/kio, and KPluginMetaData
searches the directory "kf5/kio", and since it's a relative path, it assumes
it's in the "plugins" dir.
Keep the old behaviour for repos that put the plugins in builddir/bin/
directly without a "plugins" dir.
-rw-r--r-- | modules/ECMAddTests.cmake | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake index 58c78d05..b1ebda1e 100644 --- a/modules/ECMAddTests.cmake +++ b/modules/ECMAddTests.cmake @@ -100,12 +100,14 @@ function(ecm_add_test) if (CMAKE_LIBRARY_OUTPUT_DIRECTORY) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") # https://stackoverflow.com/questions/59862894/how-do-i-make-a-list-in-cmake-with-the-semicolon-value - set(PATHSEP "\\\;") # Don't want cmake to treat it like a list + set(SEP "\\\;") # Don't want cmake to treat it like a list else() # e.g. Linux - set(PATHSEP ":") + set(SEP ":") endif() set(_plugin_path "$ENV{QT_PLUGIN_PATH}") - set_property(TEST ${_testname} PROPERTY ENVIRONMENT "QT_PLUGIN_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}${PATHSEP}${_plugin_path}") + set(_out_lib_dir "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + set_property(TEST ${_testname} + PROPERTY ENVIRONMENT "QT_PLUGIN_PATH=${_out_lib_dir}/plugins${SEP}${_out_lib_dir}${SEP}${_plugin_path}") endif() if (ARG_TARGET_NAME_VAR) set(${ARG_TARGET_NAME_VAR} "${_targetname}" PARENT_SCOPE) |