project(org_mitk_gui_qt_cmdlinemodules)

mitk_create_plugin(
  EXPORT_DIRECTIVE CLI_EXPORT
  EXPORTED_INCLUDE_SUFFIXES src
  MODULE_DEPENDS MitkQtWidgetsExt
  PACKAGE_DEPENDS
    PUBLIC  CTK|CTKWidgets
    PRIVATE CTK|CTKCommandLineModulesFrontendQtGui+CTKCommandLineModulesBackendLocalProcess Qt4|QtUiTools Qt5|UiTools+XmlPatterns
)

project(org_mitk_gui_qt_cmdlinemodules)

mitk_create_plugin(
  EXPORT_DIRECTIVE CLI_EXPORT
  EXPORTED_INCLUDE_SUFFIXES src
  MODULE_DEPENDS MitkQtWidgetsExt
  PACKAGE_DEPENDS
    PUBLIC  CTK|CTKWidgets
    PRIVATE CTK|CTKCommandLineModulesFrontendQtGui+CTKCommandLineModulesBackendLocalProcess Qt4|QtUiTools Qt5|UiTools+XmlPatterns
)

# Copy CTK Qt (designer) plugins to a Qt default path in the MITK bin
if(MITK_USE_CTK)
  if(EXISTS ${CTK_QTDESIGNERPLUGINS_DIR})
    set(_bindir ${MITK_BINARY_DIR}/bin)

    set(_releasedir)
    set(_debugdir)
    if(NOT CMAKE_CFG_INTDIR STREQUAL ".")
      set(_releasedir "Release/")
      set(_debugdir "Debug/")
    endif()

    file(COPY "${CTK_QTDESIGNERPLUGINS_DIR}/designer/${_releasedir}" DESTINATION ${_bindir}/${_releasedir}designer/)
    file(COPY "${CTK_QTDESIGNERPLUGINS_DIR}/designer/${_debugdir}" DESTINATION ${_bindir}/${_debugdir}designer/)

  endif()
endif()

Copy the CTK Qt plugin files to the binary tree
Copy the CTK Qt plugin files to the binary tree

This will copy the plugin files to a default directory for Qt plugins.
Thus they should be automatically found. Currently this is only needed for
the command line modules plugin. We might need special consideration for
mac paths.
