Skip to content

Plugin import breaks if CMAKE_RUNTIME_OUTPUT_DIRECTORY_* is set #486

Description

@Gollum999

Environment

Problem

If CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> is set, trying to load plugins will fail. Example error message:

PluginManager::Manager::Manager(): none of the plugin search paths in {C:/code/magnum/bld/vs/Debug/bin/magnum-d/importers, magnum-d/importers} exists and pluginDirectory was not set, skipping plugin discovery
PluginManager::Manager::load(): plugin TgaImporter is not static and was not found in

As described here, if this variable is set, it is used to initialize the RUNTIME_OUTPUT_DIRECTORY_<CONFIG> property of each target. This property takes precedence over the RUNITME_OUPUT_DIRECTORY property. This means that the output directories that are set in each plugin's CMakeLists end up being overridden. This causes the plugin library to not be built into the expected location, causing it to fail to load at runtime.

To reproduce

Build Magnum as a subproject as in Example 1a of the Getting Started guide. Add the following lines to CMake before add_subdirectory(magnum):

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

Then build with some plugin enabled and try to load the plugin at runtime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions