Bug#822210: sdl2-config.cmake: extra leading / trailing whitespace
Jason Pleau
jason at jpleau.ca
Sat Apr 30 01:35:57 UTC 2016
Hi (removed the SDL maintainers/developers from this email, don't want
to spam..)
On 04/29/2016 06:44 AM, Manuel A. Fernandez Montecelo wrote:
... [snip] ...
>
> At a first glance, it looks very odd for cmake to be so fussy about
> whitespace, but I guess that they have a good reason.
>
> I've been looking into it and a more definitive/robust fix could be to
> trim the strings coming from configure, so the same problem is avoided
> in other systems or in future changes to other variables. (Patch
> attached).
>
> Since "string(STRIP input output)" does not return the stripped
> string, instead of using the string() function in the same spot where
> the original variable is used, one has to use an "output variable" and
> then use the variable as substitute in the original command.
>
> So the result looks a bit ugly and duplicates the number of lines, and
> everything is a bit cumbersome, but I think that it works.
>
> Jason, if you want to test it to see if it works fine, then I can
> submit both to upstream's bug report for them to decide.
It looks like ${prefix} is not set when defining ${stripped_prefix}. So
for example SDL2_INCLUDE_DIRS is set to /include/SDL2.
I got it to work with the following:
# sdl2 cmake project-config input for ./configure scripts
string(STRIP "@prefix@" prefix)
string(STRIP "@exec_prefix@" stripped_exec_prefix)
string(STRIP "@libdir@" stripped_libdir)
string(STRIP "@includedir@" stripped_includedir)
string(STRIP "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@"
stripped_SDL2_LIBRARIES)
set(exec_prefix "${stripped_exec_prefix}")
set(libdir "${stripped_libdir}")
set(SDL2_PREFIX "${stripped_prefix}")
set(SDL2_EXEC_PREFIX "${stripped_prefix}")
set(SDL2_LIBDIR "${stripped_libdir}")
set(SDL2_INCLUDE_DIRS "${stripped_includedir}/SDL2")
set(SDL2_LIBRARIES "${stripped_SDL2_LIBRARIES}")
(patch format attached)
>
> (If anybody wants to use the attached patch as a basis for better
> patches, feel free to do it. Also anybody feel free to submit the
> patches upstream, but better if tested first).
>
>
> Cheers.
>
Thanks !
--
Jason Pleau
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_cmake_sdl_whitespace.patch
Type: text/x-patch
Size: 987 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-sdl-maintainers/attachments/20160429/226cb4ce/attachment.bin>
More information about the Pkg-sdl-maintainers
mailing list