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
--- a/sdl2-config.cmake.in
+++ b/sdl2-config.cmake.in
@@ -1,10 +1,15 @@
 # sdl2 cmake project-config input for ./configure scripts
 
-set(prefix "@prefix@") 
-set(exec_prefix "@exec_prefix@")
-set(libdir "@libdir@")
-set(SDL2_PREFIX "@prefix@")
-set(SDL2_EXEC_PREFIX "@prefix@")
-set(SDL2_LIBDIR "@libdir@")
-set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
-set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")
+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}")

Reply via email to