diff --git a/Modules/QtPython/CMakeLists.txt b/Modules/QtPython/CMakeLists.txt index 4089449246..d497d472ef 100644 --- a/Modules/QtPython/CMakeLists.txt +++ b/Modules/QtPython/CMakeLists.txt @@ -1,19 +1,18 @@ if(MITK_USE_Python3) mitkFunctionCheckCompilerFlags("/wd4273" CMAKE_CXX_FLAGS) set(OpenCV_DEP ) if(MITK_USE_OpenCV) set(OpenCV_DEP OpenCV) endif() mitk_create_module( DEPENDS MitkCore MitkQtWidgets MitkPython PACKAGE_DEPENDS PUBLIC Qt5|Widgets CTK|CTKScriptingPythonCore+CTKScriptingPythonWidgets ) - # temporarily disabled, bug-19153 - if(UNIX) + if(BUILD_TESTING) add_subdirectory(Testing) endif() endif() diff --git a/Modules/QtPython/Testing/CMakeLists.txt b/Modules/QtPython/Testing/CMakeLists.txt index f84c5188fa..e9cde47bc8 100644 --- a/Modules/QtPython/Testing/CMakeLists.txt +++ b/Modules/QtPython/Testing/CMakeLists.txt @@ -1,3 +1,19 @@ set(package_deps PACKAGE_DEPENDS PRIVATE) MITK_CREATE_MODULE_TESTS(${package_deps}) + +if(UNIX AND NOT APPLE) + #[[ The PythonQt library (dependency of MitkQtPython module) depends on Qt + libraries without absolute paths. Use LD_LIBRARY_PATH as workaround. + See T26955. ]] + if(TARGET ${TESTDRIVER}) + get_target_property(ld_library_path Qt5::Core IMPORTED_LOCATION_RELEASE) + get_filename_component(ld_library_path "${ld_library_path}" DIRECTORY) + + add_test( + NAME mitkPythonTest + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${ld_library_path}" + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkPythonTest + ) + endif() +endif() diff --git a/Modules/QtPython/Testing/files.cmake b/Modules/QtPython/Testing/files.cmake index d4301946da..2be97879a7 100644 --- a/Modules/QtPython/Testing/files.cmake +++ b/Modules/QtPython/Testing/files.cmake @@ -1,3 +1,10 @@ -set(MODULE_TESTS - mitkPythonTest.cpp -) +if(UNIX AND NOT APPLE) + # See T26955. + set(MODULE_CUSTOM_TESTS + mitkPythonTest.cpp + ) +else() + set(MODULE_TESTS + mitkPythonTest.cpp + ) +endif()