From eebaddf29efad9bc7b82d8745d839931f08ef887 Mon Sep 17 00:00:00 2001 From: Luca Sas Date: Thu, 19 Nov 2020 12:54:15 +0000 Subject: Update README.md to explain how to support C++ --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 1dd0e0d..126e027 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,26 @@ Building from the cmake file will build both raylib and `src/main.c` which inclu The example in `src/main.c` uses an example image located in the `assets` folder. -The absolute path to the assets folder is defined by a macro `ASSETS_PATH` in the CMake file automatically which is useful during development. If you plan on releasing or sharing your game consider manually setting the value of the `ASSETS_PATH` macro. \ No newline at end of file +The absolute path to the assets folder is defined by a macro `ASSETS_PATH` in the CMake file automatically which is useful during development. If you plan on releasing or sharing your game consider manually setting the value of the `ASSETS_PATH` macro. + +## How to use with C++ +To use with C++ simply rename `main.c` to `main.cpp` and then change the following lines in CMakelists.txt: + +From: +``` +project(raylib_template C) + +set(CMAKE_C_STANDARD 99) + +add_executable(raylib_template src/main.c) +``` + +To: +``` +project(raylib_template CXX) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_executable(raylib_template src/main.cpp) +``` -- cgit v1.2.3