Update 'Usage' section in README.md

This commit is contained in:
Amine B. Hassouna 2019-02-03 23:14:33 +01:00
parent ca80e4cf7b
commit 4ea07174ad

View File

@ -44,8 +44,33 @@ The improvements made to these modules are as follows:
## Usage
There is two approaches that can be adopted: A legacy approach and a modern
approach. Both of them are supported.
In order to use the SDL2 CMake modules, we have to clone this repository in a
sud-directory `cmake/sdl2` in our project as follows:
```sh
cd <PROJECT_DIR>
git clone https://gitlab.com/aminosbh/sdl2-cmake-modules.git cmake/sdl2
rm -rf cmake/sdl2/.git
```
Or if we are using git for our project, we can add this repository as a
submodule as follows:
```sh
cd <PROJECT_DIR>
git submodule add https://gitlab.com/aminosbh/sdl2-cmake-modules.git cmake/sdl2
git commit -m "Add SDL2 CMake modules"
```
Then we should specify the modules path in the main CMakeLists.txt file like
the following:
```cmake
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
```
Finally, we can use the SDL2 modules. There is two approaches that can be
adopted: A legacy approach and a modern approach. Both of them are supported.
### Modern CMake