Skip to content

Commit b9fb61f

Browse files
author
Sebastian Tarach
committed
Added FindSDL2 start and stop marker messages - message("<FindSDL2>") and ("</
Implemented support for mingw32/msys ( not tested with FindSDL2_image and _ttf ) Provided simple usage info in readme.md
1 parent 65c3777 commit b9fb61f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

FindSDL2.cmake

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
# (To distribute this file outside of CMake, substitute the full
6666
# License text for the above reference.)
6767

68+
message("<FindSDL2.cmake>")
69+
6870
SET(SDL2_SEARCH_PATHS
6971
~/Library/Frameworks
7072
/Library/Frameworks
@@ -74,6 +76,7 @@ SET(SDL2_SEARCH_PATHS
7476
/opt/local # DarwinPorts
7577
/opt/csw # Blastwave
7678
/opt
79+
${SDL2_PATH}
7780
)
7881

7982
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
@@ -158,6 +161,8 @@ IF(SDL2_LIBRARY_TEMP)
158161
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
159162
ENDIF(SDL2_LIBRARY_TEMP)
160163

164+
message("</FindSDL2.cmake>")
165+
161166
INCLUDE(FindPackageHandleStandardArgs)
162167

163168
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

readme.md

100644100755
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ from the SDL website.
1313

1414
##Usage
1515

16+
###General
17+
1618
In order to use these scripts, you first need to tell CMake where to find them, via
1719
the `CMAKE_MODULE_PATH` variable. For example, if you put them in a
1820
subdirectory called `cmake`, then in your root `CMakeLists.txt` add the line
@@ -40,6 +42,26 @@ target_link_libraries(target ${SDL2_LIBRARY}
4042

4143
or whatever is appropriate for your project.
4244

45+
###mingw32 / msys
46+
47+
This section supplements ```Usage -> General``` section. You still are required
48+
to incorporate ```General``` configuration settings in you CMakeLists.txt.
49+
50+
Because cmake binaries for windows aren't aware of *nix/win paths conversion,
51+
default paths FindSDL2 will look in won't do any good. For that you should set SDL2_PATH variable.
52+
For example:
53+
```cmake
54+
set(SDL2_PATH "D:\\apps\\SDL2\\i686-w64-mingw32")
55+
```
56+
57+
```bash
58+
mkdir build
59+
cd build
60+
cmake .. -G"MSYS Makefiles"
61+
make
62+
```
63+
64+
4365
##Licence
4466

4567
I am not the original author of these scripts. I found `FindSDL2.cmake`

0 commit comments

Comments
 (0)