SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
[PATCH] sdl2-config.cmake: don't leak prefix, exec_prefix, l
Sanya_M


Joined: 20 Mar 2011
Posts: 9
Location: Novosibirsk, Russia
Reply with quote
sdl2-config.cmake set prefix, exec_prefix, libdir in the scope where
find_package() was called. Even worse, it overwrote these variables if
they were defined.

Example:

set(prefix "testprefix")
find_package(sdl2 REQUIRED)
message(STATUS "prefix: ${prefix}")

Output before:

prefix: /usr/local

Output after:

prefix: testprefix
---
sdl2-config.cmake.in | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in
index 03efbe1..cb0821b 100644
--- a/sdl2-config.cmake.in
+++ b/sdl2-config.cmake.in
@@ -1,11 +1,22 @@
# 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 "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
+function(_sdl2_define_config)
+ 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 "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
+
+ set(SDL2_PREFIX "${SDL2_PREFIX}" PARENT_SCOPE)
+ set(SDL2_EXEC_PREFIX "${SDL2_EXEC_PREFIX}" PARENT_SCOPE)
+ set(SDL2_LIBDIR "${SDL2_LIBDIR}" PARENT_SCOPE)
+ set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIRS}" PARENT_SCOPE)
+ set(SDL2_LIBRARIES "${SDL2_LIBRARIES}" PARENT_SCOPE)
+endfunction()
+
+_sdl2_define_config()
--
2.10.1 (Apple Git-7Cool
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
View user's profileSend private messageICQ Number
[PATCH] sdl2-config.cmake: don't leak prefix, exec_prefix, l
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic