Browse Source

Drop more CMake pre-3.1 compatibility.

pull/308/head
Vladimír Vondruš 7 years ago
parent
commit
f325507618
  1. 12
      doc/plugins.dox
  2. 12
      doc/snippets/CMakeLists.txt
  3. 7
      modules/FindMagnum.cmake
  4. 4
      src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt
  5. 4
      src/MagnumPlugins/AnyImageConverter/CMakeLists.txt
  6. 4
      src/MagnumPlugins/AnyImageImporter/CMakeLists.txt
  7. 4
      src/MagnumPlugins/AnySceneImporter/CMakeLists.txt
  8. 4
      src/MagnumPlugins/MagnumFont/CMakeLists.txt
  9. 4
      src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt
  10. 4
      src/MagnumPlugins/ObjImporter/CMakeLists.txt
  11. 4
      src/MagnumPlugins/TgaImageConverter/CMakeLists.txt
  12. 4
      src/MagnumPlugins/TgaImporter/CMakeLists.txt
  13. 4
      src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

12
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. and static case.
The static plugin needs to be explicitly registered so the plugin manager is 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. aware it's there. If you use CMake, it's done automatically. Otherwise, you can
Otherwise, you can achieve the same if you explicitly @cpp #include @ce the achieve the same if you explicitly @cpp #include @ce the static plugin import
static plugin import file (named `importStaticPlugin.cpp`, residing in plugin's file (named `importStaticPlugin.cpp`, residing in plugin's include directory)
include directory) in a source file that gets compiled into your main in a source file that gets compiled into your main application. The static
application. The static import file contains just a simple call to import file contains just a simple call to @ref CORRADE_PLUGIN_IMPORT(), see
@ref CORRADE_PLUGIN_IMPORT(), see its documentation for further information. its documentation for further information.
@snippet plugins.cpp static-import @snippet plugins.cpp static-import

12
doc/snippets/CMakeLists.txt

@ -165,13 +165,6 @@ if(WITH_SDL2APPLICATION)
getting-started-blue getting-started-blue
snippets-MagnumPlatform snippets-MagnumPlatform
PROPERTIES FOLDER "Magnum/doc/snippets") 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() endif()
if((NOT TARGET_GLES AND WITH_SDL2APPLICATION) OR (TARGET_GLES AND WITH_XEGLAPPLICATION)) 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( set_target_properties(
snippets-MagnumPlatform-portability snippets-MagnumPlatform-portability
PROPERTIES FOLDER "Magnum/doc/snippets") 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() endif()
if(WITH_WINDOWLESSEGLAPPLICATION) if(WITH_WINDOWLESSEGLAPPLICATION)

7
modules/FindMagnum.cmake

@ -889,10 +889,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
mark_as_advanced(_MAGNUM_${_COMPONENT}_INCLUDE_DIR) mark_as_advanced(_MAGNUM_${_COMPONENT}_INCLUDE_DIR)
endif() endif()
# Automatic import of static plugins on CMake >= 3.1. Skip in case the # Automatic import of static plugins. Skip in case the include dir was
# include dir was not found -- that'll fail later with a proper # not found -- that'll fail later with a proper message.
# message. if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND NOT CMAKE_VERSION VERSION_LESS 3.1 AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
# Automatic import of static plugins # Automatic import of static plugins
file(READ ${_MAGNUM_${_COMPONENT}_INCLUDE_DIR}/configure.h _magnum${_component}Configure) 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) string(FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum${_component}_BUILD_STATIC)

4
src/MagnumPlugins/AnyAudioImporter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES AnyImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyAudioImporter) 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)
target_sources(AnyAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/AnyImageConverter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES AnyImageConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageConverter) 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)
target_sources(AnyImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/AnyImageImporter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES AnyImageImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnyImageImporter) 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)
target_sources(AnyImageImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/AnySceneImporter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES AnySceneImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/AnySceneImporter) 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)
target_sources(AnySceneImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/MagnumFont/CMakeLists.txt

@ -53,9 +53,7 @@ install(FILES MagnumFont.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFont) 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)
target_sources(MagnumFont INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_GL_TESTS) if(BUILD_GL_TESTS)

4
src/MagnumPlugins/MagnumFontConverter/CMakeLists.txt

@ -53,9 +53,7 @@ install(FILES MagnumFontConverter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/MagnumFontConverter) 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)
target_sources(MagnumFontConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_GL_TESTS) if(BUILD_GL_TESTS)

4
src/MagnumPlugins/ObjImporter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES ObjImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/ObjImporter) 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)
target_sources(ObjImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/TgaImageConverter/CMakeLists.txt

@ -50,9 +50,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/configure.h DESTINATION ${MAGNUM_PLUGI
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImageConverter) 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)
target_sources(TgaImageConverter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/TgaImporter/CMakeLists.txt

@ -51,9 +51,7 @@ install(FILES TgaImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/TgaImporter) 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)
target_sources(TgaImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

4
src/MagnumPlugins/WavAudioImporter/CMakeLists.txt

@ -66,9 +66,7 @@ install(FILES WavImporter.h ${CMAKE_CURRENT_BINARY_DIR}/configure.h
# Automatic static plugin import # Automatic static plugin import
if(BUILD_PLUGINS_STATIC) if(BUILD_PLUGINS_STATIC)
install(FILES importStaticPlugin.cpp DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter) 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)
target_sources(WavAudioImporter INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/importStaticPlugin.cpp)
endif()
endif() endif()
if(BUILD_TESTS) if(BUILD_TESTS)

Loading…
Cancel
Save