| Summary: | SDL2 Image CMake support | ||
|---|---|---|---|
| Product: | SDL_image | Reporter: | Kata <katamaran1987> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | krzysio.kurek, sylvain.becker |
| Version: | unspecified | ||
| Hardware: | x86_64 | ||
| OS: | Windows 10 | ||
| Attachments: | CMakeLists tree patch | ||
|
Description
Kata
2019-05-05 16:45:28 UTC
Cmake list will help for the android build. Created attachment 3929 [details]
CMakeLists tree patch
So there was a cmake tree already although it was mysteriously wrapped in `if(ANDROID)`, excluding any sort of usability on other platforms. This patch should enable easier embedding of the library in projects using cmake, although a sdl2image-config.cmake.in or something similiar would probably be in place.
I have added a few CMakeLists.txt, but I only tested them on android, I added this if(ANDROID) for this reason. see bug 3918 They were some difference between android and other platform. Like: quoting: "so you should have "target_link_libraries(yourgame SDL2 SDL2main)" in your CMakeLists.txt file. Also be aware that you should use add_library() instead of add_executable() for the target containing your "main" function." maybe this doesn't applied to libraries. Did you also try you patch with Android ? other platform ? If you want full CMake support, there are also SDL_ttf and SDL_mixer which have been updated The FindPackage failed for Android, I am not sure how to fix it:
CMake Error at SDL_image/CMakeLists.txt:4 (find_package):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.
Could not find a package configuration file provided by "SDL2" with any of
the following names:
SDL2Config.cmake
sdl2-config.cmake
modified cmakelists for jpeg is included here: https://hg.libsdl.org/SDL_image/rev/2d55bf825f71 also added the SDL_image cmake modified to still compile on android https://hg.libsdl.org/SDL_image/rev/5fcbadcc4090 I have not tried the patch with any other platform unfortunately, but I'm also pretty sure that I haven't introduced any changes that would be breaking compared to the currently existing solution. The FindSDL2 error is caused by me quite stupidly assuming that SDL2 would be installed through CMake on the system already. |