# Test-executable that loads and unloads the plugin at runtime an tests if it correctly (un-)registers static instances
ORXONOX_ADD_EXECUTABLE(
    core_plugin_test
    EXCLUDE_FROM_ALL
    NO_INSTALL
  LINK_LIBRARIES
    core
    gmock_orxonox
  SOURCE_FILES
    ${GMOCK_MAIN}
    PluginTest.cc
)

# A plugin that statically registers some instances
ORXONOX_ADD_LIBRARY(
  testplugin
    PLUGIN
    EXCLUDE_FROM_ALL
    NO_INSTALL
  LINK_LIBRARIES
    core
  SOURCE_FILES
    Testclass.cc
    Testcommandlineargument.cc
    Testconsolecommand.cc
    Testsingleton.cc
)

# let the test-executable depend on the plugin to ensure that the plugin always gets built before the test runs
ADD_DEPENDENCIES(core_plugin_test testplugin)

ADD_DEPENDENCIES(all_tests core_plugin_test)
ADD_TEST(core_plugin_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/core_plugin_test --gtest_output=xml)
