cmake_modules/FindSDL2.cmake
changeset 15578 771e94158c76
parent 11657 ae6706411b24
--- a/cmake_modules/FindSDL2.cmake	Fri Apr 17 15:23:22 2020 -0400
+++ b/cmake_modules/FindSDL2.cmake	Fri Apr 17 15:47:06 2020 -0400
@@ -1,6 +1,6 @@
 # Locate SDL2 library
 # This module defines
-# SDL2_LIBRARY, the name of the library to link against
+# SDL2_LIBRARIES, the name of the library to link against
 # SDL2_FOUND, if false, do not try to link to SDL2
 # SDL2_INCLUDE_DIR, where to find SDL.h
 #
@@ -10,7 +10,7 @@
 # only applications need main().
 # Otherwise, it is assumed you are building an application and this
 # module will attempt to locate and set the the proper link flags
-# as part of the returned SDL2_LIBRARY variable.
+# as part of the returned SDL2_LIBRARIES variable.
 #
 # Don't forget to include SDLmain.h and SDLmain.m your project for the
 # OS X framework based version. (Other versions link to -lSDL2main which
@@ -19,12 +19,12 @@
 #
 #
 # Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
-# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
+# and no SDL2_LIBRARIES, it means CMake did not find your SDL2 library
 # (SDL2.dll, libsdl2.so, SDL2.framework, etc).
 # Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
 # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
-# as appropriate. These values are used to generate the final SDL2_LIBRARY
-# variable, but when these values are unset, SDL2_LIBRARY does not get created.
+# as appropriate. These values are used to generate the final SDL2_LIBRARIES
+# variable, but when these values are unset, SDL2_LIBRARIES does not get created.
 #
 #
 # $SDL2DIR is an environment variable that would
@@ -44,7 +44,7 @@
 #
 # On OSX, this will prefer the Framework version (if found) over others.
 # People will have to manually change the cache values of
-# SDL2_LIBRARY to override this selection or set the CMake environment
+# SDL2_LIBRARIES to override this selection or set the CMake environment
 # CMAKE_INCLUDE_PATH to modify the search paths.
 #
 # Note that the header path has changed from SDL2/SDL.h to just SDL.h
@@ -76,7 +76,7 @@
     /opt
 )
 
-FIND_PATH(SDL2_INCLUDE_DIR SDL.h
+FIND_PATH(SDL2_INCLUDE_DIRS SDL.h
     HINTS
     $ENV{SDL2DIR}
     PATH_SUFFIXES include/SDL2 include
@@ -92,7 +92,7 @@
 )
 
 IF(NOT SDL2_BUILDING_LIBRARY)
-    IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
+    IF(NOT ${SDL2_INCLUDE_DIRS} MATCHES ".framework")
         # Non-OS X framework versions expect you to also dynamically link to
         # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
         # seem to provide SDL2main for compatibility even though they don't
@@ -104,7 +104,7 @@
             PATH_SUFFIXES lib64 lib
             PATHS ${SDL2_SEARCH_PATHS}
         )
-    ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
+    ENDIF(NOT ${SDL2_INCLUDE_DIRS} MATCHES ".framework")
 ENDIF(NOT SDL2_BUILDING_LIBRARY)
 
 # SDL2 may require threads on your system.
@@ -153,17 +153,17 @@
     ENDIF(MINGW)
 
     # Set the final string here so the GUI reflects the final state.
-    SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
+    SET(SDL2_LIBRARIES ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
     # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
     SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
 ENDIF(SDL2_LIBRARY_TEMP)
 
 if(BUILD_ENGINE_JS)
-    set(SDL2_LIBRARY "sdl2_emscripten_internal" CACHE STRING "emscripten override" FORCE)
-    set(SDL2_INCLUDE_DIR "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL" CACHE STRING "emscripten override" FORCE)
+    set(SDL2_LIBRARIES "sdl2_emscripten_internal" CACHE STRING "emscripten override" FORCE)
+    set(SDL2_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL" CACHE STRING "emscripten override" FORCE)
 endif()
 
 INCLUDE(FindPackageHandleStandardArgs)
 
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARIES SDL2_INCLUDE_DIRS)