From 0a07614f4f3b4b83627d6058bce0907c14be6e26 Mon Sep 17 00:00:00 2001 From: "Amine B. Hassouna" Date: Sun, 3 Feb 2019 23:03:18 +0100 Subject: [PATCH] Add 'Special customization variables' section in README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 3079e2f..8fd63e0 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,52 @@ The improvements made to these modules are as follows: `FindSDL2_.cmake` file.* +## Special customization variables + +Each module have special customization cache variables that can be used to help +the modules find the appropriate libraries: + +- `SDL2_PATH` and `SDL2__PATH`:
+ Can be specified to set the root search path for the `SDL2` and `SDL2_` +- `SDL2_NO_DEFAULT_PATH` and `SDL2__NO_DEFAULT_PATH`:
+ Disable search `SDL2/SDL2` library in default path:
+ If `SDL2[_]_PATH` is set, defaults to ON
+ Else defaults to OFF +- `SDL2_INCLUDE_DIR` and `SDL2__INCLUDE_DIR`:
+ Set headers path. (Override) +- `SDL2_LIBRARY` and `SDL2__LIBRARY`:
+ Set the library (.dll, .so, .a, etc) path. (Override) +- `SDL2MAIN_LIBRAY`:
+ Set the `SDL2main` library (.a) path. (Override) + +These variables could be used in case of Windows projects, and when the +libraries are not localized in a standard pathes. They can be specified when +executing the `cmake` command or when using the [CMake GUI][] (They are marked +as advanced). + +**cmake command example:** + +```sh +mkdir build +cd build +cmake .. -DSDL2_PATH="/path/to/sdl2" +``` + +**CMakeLists.txt example:** + +If we embed, for example, binaries of the SDL2_ttf in our project, we can +specify the cache variables values just before calling the `find_package` +command as follows: + +```cmake +set(SDL2_TTF_PATH "/path/to/sdl2_ttf" CACHE BOOL "" FORCE) +find_package(SDL2_ttf REQUIRED) +``` + + [CMake]: https://cmake.org +[CMake GUI]: https://cmake.org/runningcmake [SDL2]: https://www.libsdl.org [SDL2_image]: https://www.libsdl.org/projects/SDL_image [SDL2_ttf]: https://www.libsdl.org/projects/SDL_ttf