Archived
1
Fork 0

When building on Linux, prefer using the SDL2 config module

This is shipped by SDL2 itself, so it should be the preferred way
of finding it. Since SDL2 does not ship it in their Windows
development libraries, we still need to use the regular Find module.
This commit is contained in:
Joshua Goins 2022-02-21 07:53:08 -05:00
parent 757f61f433
commit 6d9602b12a
2 changed files with 10 additions and 2 deletions

View file

@ -16,7 +16,7 @@ include(FetchContent)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message("Linux build detected!")
find_package(SDL2 REQUIRED)
find_package(SDL2 REQUIRED CONFIG)
set(ENABLE_VULKAN TRUE)
set(ENABLE_LINUX TRUE)

View file

@ -7,6 +7,14 @@ if(ENABLE_MACOS)
set(EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sdl_metal.mm)
endif()
if(TARGET SDL2::Main)
set(EXTRA_LIBRARIES SDL2::Main)
endif()
if(TARGET SDL2::SDL2main)
set(EXTRA_LIBRARIES SDL2::SDL2main)
endif()
add_platform(
SRC
${CMAKE_CURRENT_SOURCE_DIR}/file.cpp
@ -17,9 +25,9 @@ add_platform(
MACOSX_BUNDLE ON
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
LINK_LIBRARIES
SDL2::Main
Core
GFXVulkan
SDL2::SDL2
${EXTRA_LIBRARIES}
)