diff --git a/doc/plugins.dox b/doc/plugins.dox index 18b4479ee..6ec80f034 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -134,12 +134,12 @@ but there is no need to change the above code, as it will work for both dynamic and static case. The static plugin needs to be explicitly registered so the plugin manager is -aware it's there. If you use CMake 3.1 and newer it's done automatically. -Otherwise, you can achieve the same if you explicitly @cpp #include @ce the -static plugin import file (named `importStaticPlugin.cpp`, residing in plugin's -include directory) in a source file that gets compiled into your main -application. The static import file contains just a simple call to -@ref CORRADE_PLUGIN_IMPORT(), see its documentation for further information. +aware it's there. If you use CMake, it's done automatically. Otherwise, you can +achieve the same if you explicitly @cpp #include @ce the static plugin import +file (named `importStaticPlugin.cpp`, residing in plugin's include directory) +in a source file that gets compiled into your main application. The static +import file contains just a simple call to @ref CORRADE_PLUGIN_IMPORT(), see +its documentation for further information. @snippet plugins.cpp static-import diff --git a/doc/snippets/CMakeLists.txt b/doc/snippets/CMakeLists.txt index 080e1b943..c47560526 100644 --- a/doc/snippets/CMakeLists.txt +++ b/doc/snippets/CMakeLists.txt @@ -165,13 +165,6 @@ if(WITH_SDL2APPLICATION) getting-started-blue snippets-MagnumPlatform PROPERTIES FOLDER "Magnum/doc/snippets") - # Otherwise it's not linked correctly. I have no idea why, but whatever. - if(CMAKE_VERSION VERSION_LESS 3.0) - find_package(SDL2 REQUIRED) - target_link_libraries(getting-started PRIVATE SDL2::SDL2) - target_link_libraries(getting-started-blue PRIVATE SDL2::SDL2) - target_link_libraries(snippets-MagnumPlatform PRIVATE SDL2::SDL2) - endif() endif() if((NOT TARGET_GLES AND WITH_SDL2APPLICATION) OR (TARGET_GLES AND WITH_XEGLAPPLICATION)) @@ -185,11 +178,6 @@ if((NOT TARGET_GLES AND WITH_SDL2APPLICATION) OR (TARGET_GLES AND WITH_XEGLAPPLI set_target_properties( snippets-MagnumPlatform-portability PROPERTIES FOLDER "Magnum/doc/snippets") - # Otherwise it's not linked correctly. I have no idea why, but whatever. - if(CMAKE_VERSION VERSION_LESS 3.0) - find_package(SDL2 REQUIRED) - target_link_libraries(snippets-MagnumPlatform-portability PRIVATE SDL2::SDL2) - endif() endif() if(WITH_WINDOWLESSEGLAPPLICATION) diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 7303a6f91..a35f64ee9 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -889,10 +889,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) mark_as_advanced(_MAGNUM_${_COMPONENT}_INCLUDE_DIR) endif() - # Automatic import of static plugins on CMake >= 3.1. Skip in case the - # include dir was not found -- that'll fail later with a proper - # message. - if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND NOT CMAKE_VERSION VERSION_LESS 3.1 AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR) + # Automatic import of static plugins. Skip in case the include dir was + # not found -- that'll fail later with a proper message. + if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR) # Automatic import of static plugins file(READ ${_MAGNUM_${_COMPONENT}_INCLUDE_DIR}/configure.h _magnum${_component}Configure) string(FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum${_component}_BUILD_STATIC) diff --git a/src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt b/src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt index 1287615ec..aee3f11c2 100644 --- a/src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt +++ b/src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES AnyImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyAudioImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(AnyAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(AnyAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/AnyImageConverter/CMakeLists.txt b/src/MagnumPlugins/AnyImageConverter/CMakeLists.txt index 5fb88eb1f..37741b5e6 100644 --- a/src/MagnumPlugins/AnyImageConverter/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageConverter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES AnyImageConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageConverter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(AnyImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(AnyImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/AnyImageImporter/CMakeLists.txt b/src/MagnumPlugins/AnyImageImporter/CMakeLists.txt index dbfe50359..90dfed8c8 100644 --- a/src/MagnumPlugins/AnyImageImporter/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageImporter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES AnyImageImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(AnyImageImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(AnyImageImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/AnySceneImporter/CMakeLists.txt b/src/MagnumPlugins/AnySceneImporter/CMakeLists.txt index 5e01d0fc5..62de31b15 100644 --- a/src/MagnumPlugins/AnySceneImporter/CMakeLists.txt +++ b/src/MagnumPlugins/AnySceneImporter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES AnySceneImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnySceneImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(AnySceneImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(AnySceneImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/MagnumFont/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/CMakeLists.txt index 9b23aa4f9..5e48bb20c 100644 --- a/src/MagnumPlugins/MagnumFont/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/CMakeLists.txt @@ -53,9 +53,7 @@ install(FILES MagnumFont.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFont) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(MagnumFont INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(MagnumFont INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_GL_TESTS) diff --git a/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt index 8220a3e87..f74d949f2 100644 --- a/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt @@ -53,9 +53,7 @@ install(FILES MagnumFontConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFontConverter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(MagnumFontConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(MagnumFontConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_GL_TESTS) diff --git a/src/MagnumPlugins/ObjImporter/CMakeLists.txt b/src/MagnumPlugins/ObjImporter/CMakeLists.txt index bb2197b10..29613b7dd 100644 --- a/src/MagnumPlugins/ObjImporter/CMakeLists.txt +++ b/src/MagnumPlugins/ObjImporter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES ObjImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(ObjImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(ObjImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt index 1a3775334..d5a901c73 100644 --- a/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/CMakeLists.txt @@ -50,9 +50,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGI # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(TgaImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(TgaImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/TgaImporter/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/CMakeLists.txt index 8b186ad91..7ae54c746 100644 --- a/src/MagnumPlugins/TgaImporter/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/CMakeLists.txt @@ -51,9 +51,7 @@ install(FILES TgaImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(TgaImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(TgaImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS) diff --git a/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt index 0e1f87f20..0ea786a25 100644 --- a/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt +++ b/src/MagnumPlugins/WavAudioImporter/CMakeLists.txt @@ -66,9 +66,7 @@ install(FILES WavImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h # Automatic static plugin import if(BUILD_PLUGINS_STATIC) install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter) - if(NOT CMAKE_VERSION VERSION_LESS 3.1) - target_sources(WavAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) - endif() + target_sources(WavAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp) endif() if(BUILD_TESTS)