From adf705863c0ccfe0b688aa615c306836caa9687f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 9 Sep 2012 16:08:45 +0200 Subject: [PATCH] FindSDL: add SDLMAIN_LIBRARY only once (#13262) --- Modules/FindSDL.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 487c5d346..adaec95a2 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -133,10 +133,12 @@ endif() if(SDL_LIBRARY_TEMP) # For SDLmain - if(NOT SDL_BUILDING_LIBRARY) - if(SDLMAIN_LIBRARY) - set(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) + if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY) + list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX) + if(_SDL_MAIN_INDEX EQUAL -1) + list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}") endif() + unset(_SDL_MAIN_INDEX) endif() # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.