Add patch to correctly handle libsdl2 from system/cmake
authorLocutusOfBorg
Fri, 17 Apr 2020 15:23:22 -0400
changeset 15577 107170c05bac
parent 15576 36687bc9d5c1
child 15578 771e94158c76
Add patch to correctly handle libsdl2 from system/cmake
QTfrontend/CMakeLists.txt
hedgewars/CMakeLists.txt
misc/libphyslayer/CMakeLists.txt
project_files/hwc/CMakeLists.txt
tools/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt	Sun Apr 12 00:26:37 2020 +0300
+++ b/QTfrontend/CMakeLists.txt	Fri Apr 17 15:23:22 2020 -0400
@@ -13,9 +13,9 @@
 
 include(CheckLibraryExists)
 
-find_package(SDL2 REQUIRED)
+find_package(SDL2 REQUIRED CONFIG)
 find_package(SDL2_mixer 2 REQUIRED) #audio in SDLInteraction
-include_directories(${SDL2_INCLUDE_DIR})
+include_directories(${SDL2_INCLUDE_DIRS})
 include_directories(${SDL2_MIXER_INCLUDE_DIRS})
 
 if(LIBAV_FOUND)
@@ -230,12 +230,12 @@
     )
 
 list(APPEND HW_LINK_LIBS
-    ${SDL2_LIBRARY}
+    ${SDL2_LIBRARIES}
     ${SDL2_MIXER_LIBRARIES}
     )
 
 if(WIN32 AND NOT UNIX)
-    if(NOT SDL2_LIBRARY)
+    if(NOT SDL2_LIBRARIES)
         list(APPEND HW_LINK_LIBS SDL2)
     endif()
 
--- a/hedgewars/CMakeLists.txt	Sun Apr 12 00:26:37 2020 +0300
+++ b/hedgewars/CMakeLists.txt	Fri Apr 17 15:23:22 2020 -0400
@@ -1,6 +1,6 @@
 enable_language(Pascal)
 
-find_package(SDL2 REQUIRED)
+find_package(SDL2 REQUIRED CONFIG)
 find_package(SDL2_image 2 REQUIRED)
 find_package(SDL2_net 2 REQUIRED)
 find_package(SDL2_ttf 2 REQUIRED)
@@ -130,7 +130,7 @@
     add_flag_append(CMAKE_Pascal_FLAGS "-k-framework -kOpenGL")
 
     #set the correct library or framework style depending on the main SDL
-    string(FIND "${SDL2_LIBRARY}" "dylib" sdl_framework)
+    string(FIND "${SDL2_LIBRARIES}" "dylib" sdl_framework)
     if(${sdl_framework} GREATER -1)
         add_flag_append(CMAKE_Pascal_FLAGS "-k-lsdl2 -k-lsdl2_image -k-lsdl2_mixer -k-lsdl2_ttf -k-lsdl2_net")
     else()
--- a/misc/libphyslayer/CMakeLists.txt	Sun Apr 12 00:26:37 2020 +0300
+++ b/misc/libphyslayer/CMakeLists.txt	Fri Apr 17 15:23:22 2020 -0400
@@ -1,6 +1,6 @@
-find_package(SDL2 REQUIRED)
+find_package(SDL2 REQUIRED CONFIG)
 
-include_directories(${SDL2_INCLUDE_DIR})
+include_directories(${SDL2_INCLUDE_DIRS})
 include_directories(${PHYSFS_INCLUDE_DIR})
 include_directories(${LUA_INCLUDE_DIR})
 
@@ -17,7 +17,7 @@
 set_target_properties(physlayer PROPERTIES
                           VERSION 1.0
                           SOVERSION 1.0)
-target_link_libraries(physlayer ${SDL2_LIBRARY} lua physfs)
+target_link_libraries(physlayer ${SDL2_LIBRARIES} lua physfs)
 install(TARGETS physlayer RUNTIME DESTINATION ${target_binary_install_dir}
                           LIBRARY DESTINATION ${target_library_install_dir}
                           ARCHIVE DESTINATION ${target_library_install_dir})
--- a/project_files/hwc/CMakeLists.txt	Sun Apr 12 00:26:37 2020 +0300
+++ b/project_files/hwc/CMakeLists.txt	Fri Apr 17 15:23:22 2020 -0400
@@ -1,6 +1,6 @@
 #the usual set of dependencies
 find_package(OpenGL REQUIRED)
-find_package(SDL2 REQUIRED)
+find_package(SDL2 REQUIRED CONFIG)
 find_package(SDL2_mixer 2 REQUIRED)
 find_package(SDL2_net 2 REQUIRED)
 find_package(SDL2_image 2 REQUIRED)
@@ -111,7 +111,7 @@
 target_link_libraries(hwengine  fpcrtl
                                 ${LUA_LIBRARY}
                                 ${OPENGL_LIBRARY}
-                                ${SDL2_LIBRARY}
+                                ${SDL2_LIBRARIES}
                                 ${SDL2_MIXER_LIBRARIES}
                                 ${SDL2_NET_LIBRARIES}
                                 ${SDL2_IMAGE_LIBRARIES}
--- a/tools/CMakeLists.txt	Sun Apr 12 00:26:37 2020 +0300
+++ b/tools/CMakeLists.txt	Fri Apr 17 15:23:22 2020 -0400
@@ -8,7 +8,7 @@
 
 if(APPLE AND NOT SKIPBUNDLE)
     find_package(Qt5 REQUIRED QUIET COMPONENTS Core Widgets Gui Network)
-    find_package(SDL2 REQUIRED)
+    find_package(SDL2 REQUIRED CONFIG)
     find_package(SDL2_image 2 REQUIRED)
     find_package(SDL2_net 2 REQUIRED)
     find_package(SDL2_ttf 2 REQUIRED)
@@ -26,9 +26,9 @@
         endif()
     endif()
 
-    #remove the ";-framework Cocoa" from the SDL2_LIBRARY variable
-    string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL2_LIBRARY}")
-    #remove the "libSDLmain.a" from the SDL2_LIBRARY variable
+    #remove the ";-framework Cocoa" from the SDL2_LIBRARIES variable
+    string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL2_LIBRARIES}")
+    #remove the "libSDLmain.a" from the SDL2_LIBRARIES variable
     string(REGEX REPLACE ".*;(.*)" "\\1" sdl_library_only "${sdl_library_only}")
 
     #get the neme of the library (harmelss if it is static)