#.rst: # Find SDL2 # --------- # # Finds the SDL2 library. This module defines: # # SDL2_FOUND - True if SDL2 library is found # SDL2::SDL2 - SDL2 imported target # # Additionally these variables are defined for internal usage: # # SDL2_LIBRARY_DEBUG - SDL2 debug library, if found # SDL2_LIBRARY_RELEASE - SDL2 release library, if found # SDL2_DLL_DEBUG - SDL2 debug DLL on Windows, if found # SDL2_DLL_RELEASE - SDL2 release DLL on Windows, if found # SDL2_INCLUDE_DIR - Root include dir # # # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, # 2020, 2021, 2022 Vladimír Vondruš # Copyright © 2018 Jonathan Hale # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # # If we have a CMake subproject, use the targets directly. I'd prefer the # static variant, however SDL2 defines its own SDL2::SDL2 alias for only the # dynamic variant since https://github.com/libsdl-org/SDL/pull/4074 and so I'm # forced to use that, if available. if(TARGET SDL2) # In case we don't have https://github.com/libsdl-org/SDL/pull/4074 yet, # do the alias ourselves. if(NOT TARGET SDL2::SDL2) # Aliases of (global) targets are only supported in CMake 3.11, so we # work around it by this. This is easier than fetching all possible # properties (which are impossible to track of) and then attempting to # rebuild them into a new target. add_library(SDL2::SDL2 INTERFACE IMPORTED) set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES SDL2) endif() # Just to make FPHSA print some meaningful location, nothing else. Not # using the INTERFACE_INCLUDE_DIRECTORIES as that contains # $