FindSDL causes SDL_LIBRARY_TEMP to grow with every call
Every time a project calls find_package(SDL)
, one or more libraries are appended to a variable called SDL_LIBRARY_TEMP
which is then stored in the cache. This causes that variable to grow with every invocation, with unnecessary duplicates being appended each time. The code in FindSDL.cmake responsible for this behaviour is the following:
if(APPLE)
set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa")
endif()
and
if(NOT APPLE)
set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
because later in the file there is:
set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")