From 282f95d7239dbd4096896094d951cccc7a4782e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 4 Oct 2024 19:12:56 +0200 Subject: [PATCH] CMake: install and automatically use Find modules of dependencies. In short this means the users no longer need to care about FindSDL2 etc., it'll just get done automatically. They don't need to drag along FindMagnum / FindCorrade anymore either, but having them gives a much more reasonable error message if the library cannot be located at all, so I still recommend having them. --- doc/changelog-old.dox | 2 +- doc/changelog.dox | 4 ++ doc/cmake.dox | 36 +--------------- doc/getting-started.dox | 17 ++++---- doc/namespaces.dox | 16 ++------ doc/platforms-android.dox | 6 --- doc/platforms-html5.dox | 12 ------ doc/troubleshooting.dox | 7 ++-- modules/CMakeLists.txt | 41 +++++++++++++++++++ modules/FindMagnum.cmake | 34 +++++++++++++++ src/Magnum/Audio/Extensions.h | 5 +-- src/Magnum/Platform/AndroidApplication.h | 9 ++-- src/Magnum/Platform/EmscriptenApplication.h | 8 ++-- src/Magnum/Platform/GlfwApplication.h | 4 +- src/Magnum/Platform/Sdl2Application.h | 7 ++-- .../Platform/WindowlessEglApplication.h | 6 +-- .../Platform/WindowlessIosApplication.h | 5 +-- src/Magnum/Platform/XEglApplication.h | 5 +-- 18 files changed, 115 insertions(+), 109 deletions(-) diff --git a/doc/changelog-old.dox b/doc/changelog-old.dox index db736553c..ba1ba4939 100644 --- a/doc/changelog-old.dox +++ b/doc/changelog-old.dox @@ -1192,7 +1192,7 @@ a high-level overview. [mosra/magnum#113](https://github.com/mosra/magnum/issues/113)) - Explicit list of extensions that are available in WebGL builds - New page explaining @ref opengl-wrapping "OpenGL wrapper layer" -- Documented extra CMake modules in @ref cmake-modules +- Documented extra CMake modules - The @ref building documentation now prefers package installation instead of manual build - Clarified behavior of @ref Math::Matrix4::lookAt() (see diff --git a/doc/changelog.dox b/doc/changelog.dox index 7b86aac66..bb1fae3f4 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1096,6 +1096,10 @@ See also: to copy resources and assets to the APK. See @ref platforms-android-apps-cmake "the corresponding Android platform documentation" and [mosra/toolchains#10](https://github.com/mosra/toolchains/pull/10) for more information +- Magnum now automatically installs and uses Find modules for its + dependencies in a way that doesn't clash with modules of the same name + potentially installed by other software, meaning the user doesn't need to + copy and carry them along anymore (see [mosra/magnum#436](https://github.com/mosra/magnum/issues/436)) @subsection changelog-latest-bugfixes Bug fixes diff --git a/doc/cmake.dox b/doc/cmake.dox index 7e11f08d3..ffc50d439 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -53,10 +53,7 @@ find_package(Magnum REQUIRED ...) # see below @endcode Otherwise, if CMake won't be able to find this file in predefined locations, it -will error out even if Magnum might be installed on the system. There are other -Find modules that you might need for particular features or platforms, see -the @ref cmake-modules "full list below". Each library that needs one of the -extra modules also mentions the requirement in its documentation. Note that the +will error out even if Magnum might be installed on the system. Note that the module files are updated as the library evolves, you are encouraged to update your copies from time to time to avoid strange building issues. @@ -352,36 +349,5 @@ Corrade library provides also its own set of CMake macros and variables, see @ref corrade-cmake "its documentation" for more information. @ref cmake-plugins "Plugins repository", @ref cmake-integration "Integration repository" and @ref cmake-extras "Extras repository" have also their own CMake modules. - -@section cmake-modules Other CMake modules - -The `modules/` directory of Magnum sources contains more useful CMake modules. -If a library requires presence of any of these, it mentions them in its usage -documentation. - -- [FindOpenAL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenAL.cmake) - --- CMake module for finding OpenAL. This is a forked version of the - upstream module that works properly with - @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". Copy this to your module - directory if you want to use the @ref Audio library on Emscripten. -- [FindGLFW.cmake](https://github.com/mosra/magnum/blob/master/modules/FindGLFW.cmake) - --- CMake module for finding GLFW. Copy this to your module directory if - you want to use @ref Platform::GlfwApplication. -- [FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake) - --- CMake module for finding EGL. Copy this to your module directory if you - want to use the @ref GL library on embedded platforms such as - @ref CORRADE_TARGET_IOS "iOS", @ref CORRADE_TARGET_ANDROID "Android", - @ref CORRADE_TARGET_WINDOWS_RT "Windows RT" or - @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" or if you want to use EGL - instead of GLX/WGL/CGL on a desktop platform. -- [FindOpenGLES2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES2.cmake), - [FindOpenGLES3.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES3.cmake) - --- CMake module for finding OpenGL ES 2.0 / 3.0 library. Copy this to your - module directory if you want to use the @ref GL library on - @ref MAGNUM_TARGET_GLES "OpenGL ES". -- [FindSDL2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindSDL2.cmake) - --- CMake module for finding SDL 2. Copy this to your module directory if - you want to use @ref Platform::Sdl2Application. - */ } diff --git a/doc/getting-started.dox b/doc/getting-started.dox index 5ee475202..0cba21664 100644 --- a/doc/getting-started.dox +++ b/doc/getting-started.dox @@ -149,12 +149,11 @@ systems, and outside of the standard prefix if using MinGW on Windows). @section getting-started-review 2. Review project structure -The base project consists of just six files in two subfolders (plus the three +The base project consists of just five files in two subfolders (plus the three extra directories with dependencies you might have added): modules/FindCorrade.cmake modules/FindMagnum.cmake - modules/FindSDL2.cmake src/MyApplication.cpp src/CMakeLists.txt CMakeLists.txt @@ -163,14 +162,14 @@ In root there is the project-wide `CMakeLists.txt`, which you have seen above. It just sets up project name, specifies module directory and delegates everything important to `CMakeLists.txt` in the `src/` subdirectory. -The `modules/` directory contains CMake modules for finding the needed -dependencies. These are needed mainly with externally installed dependencies +The `modules/` directory contains CMake modules for finding the Magnum +dependencies. These are mainly useful with externally installed dependencies (@ref getting-started-setup-install "Option B" above), less so for the CMake -subproject setup. Unlike modules for finding e.g. OpenGL, which are a part of -the standard CMake installation, these aren't and thus have to be distributed -with the project. These files are verbatim copied from the -[modules/](https://github.com/mosra/magnum/tree/master/modules) directory in -the Magnum repository. +subproject setup. You don't *strictly* need them as they're part of the Magnum +installation, but if they're present, they provide a much better failure +diagnostic in case Magnum cannot be found at all. These files are verbatim +copied from the [modules/](https://github.com/mosra/magnum/tree/master/modules) +directory in the Magnum repository. The `src/` directory contains the actual project. To keep things simple, the project consists of just a single `MyApplication.cpp` file with the most diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 2a2a02bec..9ae4c363a 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -288,9 +288,8 @@ Audio import, playback and integration with @ref SceneGraph. This library depends on the [OpenAL](https://www.openal.org/) library and is built if `MAGNUM_WITH_AUDIO` is enabled when building Magnum. To use this -library with CMake, put [FindOpenAL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenAL.cmake) -into your `modules/` directory, request the `Audio` component of the `Magnum` -package and link to the `Magnum::Audio` target: +library with CMake, request the `Audio` component of the `Magnum` package and +link to the `Magnum::Audio` target: @code{.cmake} find_package(Magnum REQUIRED Audio) @@ -368,12 +367,6 @@ find_package(Magnum REQUIRED GL) target_link_libraries(your-app PRIVATE Magnum::GL) @endcode -In case you're building for EGL or OpenGL ES platforms, you also need to put -[FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake), -[FindOpenGLES2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES2.cmake) -or [FindOpenGLES3.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES3.cmake) -into your `modules/` directory. - See @ref building, @ref cmake and @ref opengl for more information. @m_class{m-block m-success} @@ -896,9 +889,8 @@ C++14 wrappers and helpers for Vulkan development. This library is depends on [Vulkan](https://www.khronos.org/vulkan/) and is built if `MAGNUM_WITH_VK` is enabled when building Magnum. To use this library -with CMake, put [FindVulkan.cmake](https://github.com/mosra/magnum/blob/master/modules/FindVulkan.cmake) -into your `modules/` directory, request the `Vk` component of the `Magnum` -package and link to the `Magnum::Vk` target: +with CMake, request the `Vk` component of the `Magnum` package and link to the +`Magnum::Vk` target: @code{.cmake} find_package(Magnum REQUIRED Vk) diff --git a/doc/platforms-android.dox b/doc/platforms-android.dox index f834d6616..7d5ececd4 100644 --- a/doc/platforms-android.dox +++ b/doc/platforms-android.dox @@ -109,12 +109,6 @@ information about OpenGL testing. @section platforms-android-apps Building and installing graphics apps -In case you don't have an OpenGL ES build set up yet, you need to copy -`FindEGL.cmake` and `FindOpenGLES2.cmake` (or `FindOpenGLES3.cmake`) from the -[modules/](https://github.com/mosra/magnum/tree/master/modules) directory in -Magnum source to the `modules/` dir in your project so it is able to find EGL -and OpenGL ES libraries. - Magnum provides Android application wrapper in @ref Platform::AndroidApplication. See its documentation for more information about general usage. You can also use the Android Native Activity directly or any other way. diff --git a/doc/platforms-html5.dox b/doc/platforms-html5.dox index cc656613c..594122b81 100644 --- a/doc/platforms-html5.dox +++ b/doc/platforms-html5.dox @@ -96,12 +96,6 @@ node my-application.js @section platforms-html5-apps Building and deploying graphical apps -In case you don't have an OpenGL ES build set up yet, you need to copy -`FindOpenGLES2.cmake` (or `FindOpenGLES3.cmake`) from the -[modules/](https://github.com/mosra/magnum/tree/master/modules) directory in -Magnum source to the `modules/` dir in your project so it is able to find the -WebGL libraries. - Magnum provides Emscripten application wrappers in @ref Platform::Sdl2Application and @ref Platform::EmscriptenApplication. See their documentation for more information about general usage. You can also use the Emscripten APIs directly @@ -209,12 +203,6 @@ webserver again by pressing @m_class{m-label m-warning} **Ctrl** @section platforms-html5-windowless-apps Building and deploying windowless apps -In case you don't have an EGL + OpenGL ES build set up yet, you need to copy -`FindEGL.cmake` and `FindOpenGLES2.cmake` (or `FindOpenGLES3.cmake`) from the -[modules/](https://github.com/mosra/magnum/tree/master/modules) directory in -Magnum source to the `modules/` dir in your project so it is able to find the -EGL and WebGL libraries. - Windowless Magnum apps (i.e. apps that use the OpenGL context without a window) can be run in the browser as well using the @ref Platform::WindowlessEglApplication class. See its documentation for more information about general usage. You can diff --git a/doc/troubleshooting.dox b/doc/troubleshooting.dox index 28a8e5881..45cb8f105 100644 --- a/doc/troubleshooting.dox +++ b/doc/troubleshooting.dox @@ -37,9 +37,10 @@ If your project suddenly stops building after a Magnum upgrade, check these things: - If building fails on the CMake step, be sure that you have up-to-date - `FindCorrade.cmake`, `FindMagnum.cmake` and other CMake modules in your - project (`FindSDL2.cmake`, ...). They are contained in `modules/` directory - of Magnum repositories and also get installed into `share/cmake/Magnum`. + `FindCorrade.cmake` and `FindMagnum.cmake` CMake modules in your project. + They are contained in the [modules/](https://github.com/mosra/magnum/tree/master/modules) + directory of Magnum repositories and also get installed into + `share/cmake/Corrade` and `share/cmake/Magnum`. - In very rare cases the CMake build directory may not survive an upgrade. If you get some particularly cursed errors, try recreating it from scratch. - The library is constantly evolving, meaning that APIs may get deprecated diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 34594a81a..0d5b70723 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -28,4 +28,45 @@ set(Magnum_MODULES FindMagnum.cmake MagnumConfig.cmake) +# IMPORTANT: When adding a new module here, be sure to update the +# find_path(_MAGNUM_DEPENDENCY_MODULE_DIR ...) list in FindMagnum.cmake to +# avoid breakages when the directory contains only that new module. +set(Magnum_DEPENDENCY_MODULES ) +# TODO update once AndroidApplication uses GL only optionally +if(MAGNUM_WITH_ANDROIDAPPLICATION OR MAGNUM_WITH_WINDOWLESSEGLAPPLICATION OR MAGNUM_WITH_WINDOWLESSIOSAPPLICATION OR MAGNUM_WITH_XEGLAPPLICATION OR MAGNUM_WITH_EGLCONTEXT OR ((MAGNUM_WITH_SDL2APPLICATION OR MAGNUM_WITH_SDL2APPLICATION) AND MAGNUM_TARGET_GL AND MAGNUM_TARGET_EGL)) + list(APPEND Magnum_DEPENDENCY_MODULES + FindEGL.cmake) +endif() +if(MAGNUM_WITH_GLFWAPPLICATION) + list(APPEND Magnum_DEPENDENCY_MODULES + FindGLFW.cmake) +endif() +if(MAGNUM_WITH_AUDIO) + list(APPEND Magnum_DEPENDENCY_MODULES + FindOpenAL.cmake) +endif() +if(MAGNUM_WITH_GL AND MAGNUM_TARGET_GLES) + if(MAGNUM_TARGET_GLES2) + list(APPEND Magnum_DEPENDENCY_MODULES + FindOpenGLES2.cmake) + else() + list(APPEND Magnum_DEPENDENCY_MODULES + FindOpenGLES3.cmake) + endif() +endif() +if(MAGNUM_WITH_SDL2APPLICATION) + list(APPEND Magnum_DEPENDENCY_MODULES + FindSDL2.cmake) +endif() +if(MAGNUM_WITH_VK) + list(APPEND Magnum_DEPENDENCY_MODULES + FindVulkan.cmake) +endif() + install(FILES ${Magnum_MODULES} DESTINATION ${MAGNUM_CMAKE_MODULE_INSTALL_DIR}) +if(Magnum_DEPENDENCY_MODULES) + install(FILES ${Magnum_DEPENDENCY_MODULES} DESTINATION ${MAGNUM_CMAKE_MODULE_INSTALL_DIR}/dependencies) +endif() + +# Magnum dependency module dir for superprojects +set(_MAGNUM_DEPENDENCY_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 226628d19..1c9c521c3 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -323,6 +323,30 @@ if(MAGNUM_BUILD_DEPRECATED) endif() endif() +# CMake module dir for dependencies. It might not be present at all if no +# feature that needs them is enabled, in which case it'll be left at NOTFOUND. +# But in that case it should also not be subsequently needed for any +# find_package(). If this is called from a superproject, the +# _MAGNUM_DEPENDENCY_MODULE_DIR is already set by modules/CMakeLists.txt. +find_path(_MAGNUM_DEPENDENCY_MODULE_DIR + NAMES + FindEGL.cmake FindGLFW.cmake FindOpenAL.cmake FindOpenGLES2.cmake + FindOpenGLES3.cmake FindSDL2.cmake FindVulkan.cmake + PATH_SUFFIXES share/cmake/Magnum/dependencies) +mark_as_advanced(_MAGNUM_DEPENDENCY_MODULE_DIR) + +# If the module dir is found and is not present in CMAKE_MODULE_PATH already +# (such as when someone explicitly added it, or if it's the Magnum's modules/ +# dir in case of a superproject), add it as the first before all other. Set a +# flag to remove it again at the end, so the modules don't clash with Find +# modules of the same name from other projects. +if(_MAGNUM_DEPENDENCY_MODULE_DIR AND NOT _MAGNUM_DEPENDENCY_MODULE_DIR IN_LIST CMAKE_MODULE_PATH) + set(CMAKE_MODULE_PATH ${_MAGNUM_DEPENDENCY_MODULE_DIR} ${CMAKE_MODULE_PATH}) + set(_MAGNUM_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH ON) +else() + unset(_MAGNUM_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH) +endif() + # Base Magnum library if(NOT TARGET Magnum::Magnum) add_library(Magnum::Magnum UNKNOWN IMPORTED) @@ -710,6 +734,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # Decide if the library was found. If not, skip the rest, which # populates the target properties and finds additional dependencies. + # This means that the rest can also rely on that e.g. FindEGL.cmake is + # present in _MAGNUM_DEPENDENCY_MODULE_DIR -- given that the library + # needing EGL was found, it likely also installed FindEGL for itself. if(((_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS) AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR AND (MAGNUM_${_COMPONENT}_LIBRARY_DEBUG OR MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)) OR (_component IN_LIST _MAGNUM_EXECUTABLE_COMPONENTS AND MAGNUM_${_COMPONENT}_EXECUTABLE)) set(Magnum_${_component}_FOUND TRUE) else() @@ -1112,6 +1139,13 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16) set(_MAGNUM_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_MAGNUM_REASON_FAILURE_MESSAGE}") endif() +# Remove Magnum's dependency module dir from CMAKE_MODULE_PATH again. Do it +# before the FPHSA call which may exit early in case of a failure. +if(_MAGNUM_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH) + list(REMOVE_ITEM CMAKE_MODULE_PATH ${_MAGNUM_DEPENDENCY_MODULE_DIR}) + unset(_MAGNUM_REMOVE_DEPENDENCY_MODULE_DIR_FROM_CMAKE_PATH) +endif() + # Complete the check with also all components include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Magnum diff --git a/src/Magnum/Audio/Extensions.h b/src/Magnum/Audio/Extensions.h index a1cd637c4..366b3249f 100644 --- a/src/Magnum/Audio/Extensions.h +++ b/src/Magnum/Audio/Extensions.h @@ -49,9 +49,8 @@ compile-time decisions rather than @ref Extension instances. See This library depends on the [OpenAL](https://www.openal.org/) library and is built if `MAGNUM_WITH_AUDIO` is enabled when building Magnum. To use this -library with CMake, put [FindOpenAL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenAL.cmake) -into your `modules/` directory, request the `Audio` component of the `Magnum` -package and link to the `Magnum::Audio` target: +library with CMake, request the `Audio` component of the `Magnum` package and +link to the `Magnum::Audio` target: @code{.cmake} find_package(Magnum REQUIRED Audio) diff --git a/src/Magnum/Platform/AndroidApplication.h b/src/Magnum/Platform/AndroidApplication.h index b59cda5e7..22a87f7ac 100644 --- a/src/Magnum/Platform/AndroidApplication.h +++ b/src/Magnum/Platform/AndroidApplication.h @@ -90,12 +90,9 @@ together with a troubleshooting guide is available in @ref platforms-android. @section Platform-AndroidApplication-usage General usage This application library is built if `MAGNUM_WITH_ANDROIDAPPLICATION` is -enabled when building Magnum. To use this library with CMake, put -[FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake) -and [FindOpenGLES2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES2.cmake) (or -[FindOpenGLES3.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES3.cmake)) -into your `modules/` directory, request the `AndroidApplication` component of -the `Magnum` package and link to the `Magnum::AndroidApplication` target: +enabled when building Magnum. To use this library with CMake, request the +`AndroidApplication` component of the `Magnum` package and link to the +`Magnum::AndroidApplication` target: @code{.cmake} find_package(Magnum REQUIRED) diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index 9f6199e06..a470ad30c 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -141,11 +141,9 @@ together with a troubleshooting guide is available in @ref platforms-html5. @section Platform-EmscriptenApplication-usage General usage This application library is built if `MAGNUM_WITH_EMSCRIPTENAPPLICATION` is -enabled when building Magnum. To use this library with CMake, put -[FindOpenGLES2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES2.cmake) (or -[FindOpenGLES3.cmake](https://github.com/mosra/magnum/blob/master/modules/FindOpenGLES3.cmake)) -into your `modules/` directory, request the `EmscriptenApplication` component -of the `Magnum` package and link to the `Magnum::EmscriptenApplication` target: +enabled when building Magnum. To use this library with CMake, request the +`EmscriptenApplication` component of the `Magnum` package and link to the +`Magnum::EmscriptenApplication` target: @code{.cmake} find_package(Magnum REQUIRED) diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index ab5ad3659..830a90a64 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -101,9 +101,7 @@ See @ref cmake for more information. This application library depends on the [GLFW](http://glfw.org) library and is built if `MAGNUM_WITH_GLFWAPPLICATION` is enabled when building Magnum. To use -this library with CMake, put -[FindGLFW.cmake](https://github.com/mosra/magnum/blob/master/modules/FindGLFW.cmake) -into your `modules/` directory, request the `GlfwApplication` component of the +this library with CMake, request the `GlfwApplication` component of the `Magnum` package and link to the `Magnum::GlfwApplication` target: @code{.cmake} diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 74e92584d..9de903728 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -211,10 +211,9 @@ final package along with a PowerShell script for easy local installation. This application library depends on the [SDL2](http://www.libsdl.org) library (Emscripten has it built in) and is built if `MAGNUM_WITH_SDL2APPLICATION` is -enabled when building Magnum. To use this library with CMake, put -[FindSDL2.cmake](https://github.com/mosra/magnum/blob/master/modules/FindSDL2.cmake) -into your `modules/` directory, request the `Sdl2Application` component of -the `Magnum` package and link to the `Magnum::Sdl2Application` target: +enabled when building Magnum. To use this library with CMake, request the +`Sdl2Application` component of the `Magnum` package and link to the +`Magnum::Sdl2Application` target: @code{.cmake} find_package(Magnum REQUIRED Sdl2Application) diff --git a/src/Magnum/Platform/WindowlessEglApplication.h b/src/Magnum/Platform/WindowlessEglApplication.h index bb42fe560..897ccaa78 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.h +++ b/src/Magnum/Platform/WindowlessEglApplication.h @@ -497,10 +497,8 @@ together with a troubleshooting guide is available in @ref platforms-html5. @section Platform-WindowlessEglApplication-usage General usage This application library is built if `MAGNUM_WITH_WINDOWLESSEGLAPPLICATION` is -enabled when building Magnum. To use this library from CMake, put -[FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake) -into your `modules/` directory, request the `WindowlessEglApplication` -component of the `Magnum` package and link to the +enabled when building Magnum. To use this library from CMake, request the +`WindowlessEglApplication` component of the `Magnum` package and link to the `Magnum::WindowlessEglApplication` target: @code{.cmake} diff --git a/src/Magnum/Platform/WindowlessIosApplication.h b/src/Magnum/Platform/WindowlessIosApplication.h index b20efda03..cc5cdd2b4 100644 --- a/src/Magnum/Platform/WindowlessIosApplication.h +++ b/src/Magnum/Platform/WindowlessIosApplication.h @@ -278,9 +278,8 @@ See @ref cmake for more information. @section Platform-WindowlessIosApplication-usage General usage This application library is built if `MAGNUM_WITH_WINDOWLESSIOSAPPLICATION` is -enabled when building Magnum. To use this library from CMake, put [FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake) -into your `modules/` directory, request the `WindowlessIosApplication` -component of the `Magnum` package and link to the +enabled when building Magnum. To use this library from CMake, request the +`WindowlessIosApplication` component of the `Magnum` package and link to the `Magnum::WindowlessIosApplication` target: @code{.cmake} diff --git a/src/Magnum/Platform/XEglApplication.h b/src/Magnum/Platform/XEglApplication.h index dd4baad97..adfc1fb56 100644 --- a/src/Magnum/Platform/XEglApplication.h +++ b/src/Magnum/Platform/XEglApplication.h @@ -58,9 +58,8 @@ more information. This application library depends on **X11** and **EGL** libraries and is built if `MAGNUM_WITH_XEGLAPPLICATION` is enabled when building Magnum. To use this -library from CMake, put [FindEGL.cmake](https://github.com/mosra/magnum/blob/master/modules/FindEGL.cmake) -into your `modules/` directory, request the `XEglApplication` component of the -`Magnum` package and link to the `Magnum::XEglApplication` target: +library from CMake, request the `XEglApplication` component of the `Magnum` +package and link to the `Magnum::XEglApplication` target: @code{.cmake} find_package(Magnum REQUIRED XEglApplication)