-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: minor correction to support Ubuntu 20.04 #651
Conversation
Is this complete ? Wanted to check as there looks like some line ending or whitespace change? Thanks for this - Didn't expect this so soon after I tried to offload the work :-) |
Ah sorry - the other change is the one you referenced with BOM - I wasn't sure what that mean't |
Will test and merge - sorry for spam. |
Thanks! |
Just wanted to clarify that the solution is not described correctly and can be misleading. Adding What the solution in this PR does is to add
Then, what CMake does with the suffixes is to search like this (before this PR):
This is the reason why SDL2 couldn't be found in the case. Now, with the change in this PR, the path suffix
As you can notice, most paths to search are obviously wrong but still the right ones are there so "it works". This is the reason why I recommend to use a modern, better programmed, Sorry to be pedantic but I feel this needs to be understood correctly to know how CMake really works. I hope this is clearer now. Cheers! |
Appreciated. Thanks. |
I also agree - and the FindSDL2 code is based on even older FindSDL code. It should imho be using sdl2-config / pkg-config or something rather than just trying lots of paths etc. |
PRs welcome ;-) |
The modern way for CMake is to use config modules which are similar to the concept of sdl2-config/pkg-config. Dependencies are responsible for providing these CMake config modules. In fact SDL2 does provide one since ~2017 so is not guaranteed to be provided for older versions. On the other hand pkg-config files provided by dependencies are known to sometimes be wrong therefore CMake doesn't recommend using them (even though SDL2's pkg-config files are correct most of the time). The modernised It does not use sdl2-config, pkg-config nor a config module but relies on CMake itself to do search (which is pretty smart actually) for maximum compatibility across different platforms. It also makes sure to use compiler flags in the correct order and to use SDL2main when necessary.
Okay will do! |
cmake: minor correction to support Ubuntu 20.04
Looks like
libsdl2-dev
on Ubuntu 20.04 (and Debian testing at the moment) have relocated the headers to/usr/include/<platform-triplet>
1, so detection forSDL.h
fails currently.Augment
PATH_SUFFIXES
to search in/usr/include/<triplet>
(thanks @hhromic).We should probably revise the
FindSDL2.cmake
package with a more modern version.Minor - remove BOM from
FindRapidJSON.cmake
(fixes #643) to fix an bug in old CMake versions.[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909740