mirror of https://github.com/libsdl-org/SDL
cmake: on Apple, don't use find_library for frameworks + use EXTRA_LDFLAGS
This commit is contained in:
parent
613ce7850e
commit
4690689a4c
|
@ -15,6 +15,9 @@ if (HAIKU)
|
||||||
set(LINKER_LANGUAGE CXX)
|
set(LINKER_LANGUAGE CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(EXTRA_LIBS)
|
||||||
|
set(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
# This is a virtual "library" that just exists to collect up compiler and
|
# This is a virtual "library" that just exists to collect up compiler and
|
||||||
# linker options that used to be global to this CMake project. When you
|
# linker options that used to be global to this CMake project. When you
|
||||||
# specify it as part of a real library's target_link_libraries(), that
|
# specify it as part of a real library's target_link_libraries(), that
|
||||||
|
@ -2116,52 +2119,40 @@ elseif(APPLE)
|
||||||
|
|
||||||
# Actually load the frameworks at the end so we don't duplicate include.
|
# Actually load the frameworks at the end so we don't duplicate include.
|
||||||
if(SDL_FRAMEWORK_COREVIDEO)
|
if(SDL_FRAMEWORK_COREVIDEO)
|
||||||
find_library(COREVIDEO CoreVideo)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreVideo")
|
||||||
list(APPEND EXTRA_LIBS ${COREVIDEO})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COCOA)
|
if(SDL_FRAMEWORK_COCOA)
|
||||||
find_library(COCOA_LIBRARY Cocoa)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Cocoa")
|
||||||
list(APPEND EXTRA_LIBS ${COCOA_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_IOKIT)
|
if(SDL_FRAMEWORK_IOKIT)
|
||||||
find_library(IOKIT IOKit)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,IOKit")
|
||||||
list(APPEND EXTRA_LIBS ${IOKIT})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_FF)
|
if(SDL_FRAMEWORK_FF)
|
||||||
find_library(FORCEFEEDBACK ForceFeedback)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,ForceFeedback")
|
||||||
list(APPEND EXTRA_LIBS ${FORCEFEEDBACK})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_CARBON)
|
if(SDL_FRAMEWORK_CARBON)
|
||||||
find_library(CARBON_LIBRARY Carbon)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Carbon")
|
||||||
list(APPEND EXTRA_LIBS ${CARBON_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COREAUDIO)
|
if(SDL_FRAMEWORK_COREAUDIO)
|
||||||
find_library(COREAUDIO CoreAudio)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreAudio")
|
||||||
list(APPEND EXTRA_LIBS ${COREAUDIO})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_AUDIOTOOLBOX)
|
if(SDL_FRAMEWORK_AUDIOTOOLBOX)
|
||||||
find_library(AUDIOTOOLBOX AudioToolbox)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AudioToolbox")
|
||||||
list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_AVFOUNDATION)
|
if(SDL_FRAMEWORK_AVFOUNDATION)
|
||||||
find_library(AVFOUNDATION AVFoundation)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AVFoundation")
|
||||||
list(APPEND EXTRA_LIBS ${AVFOUNDATION})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COREBLUETOOTH)
|
if(SDL_FRAMEWORK_COREBLUETOOTH)
|
||||||
find_library(COREBLUETOOTH CoreBluetooth)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreBluetooth")
|
||||||
list(APPEND EXTRA_LIBS ${COREBLUETOOTH})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COREGRAPHICS)
|
if(SDL_FRAMEWORK_COREGRAPHICS)
|
||||||
find_library(COREGRAPHICS CoreGraphics)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreGraphics")
|
||||||
list(APPEND EXTRA_LIBS ${COREGRAPHICS})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COREMOTION)
|
if(SDL_FRAMEWORK_COREMOTION)
|
||||||
find_library(COREMOTION CoreMotion)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreMotion")
|
||||||
list(APPEND EXTRA_LIBS ${COREMOTION})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_FOUNDATION)
|
if(SDL_FRAMEWORK_FOUNDATION)
|
||||||
find_library(FOUNDATION Foundation)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Foundation")
|
||||||
list(APPEND EXTRA_LIBS ${FOUNDATION})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_GAMECONTROLLER)
|
if(SDL_FRAMEWORK_GAMECONTROLLER)
|
||||||
find_library(GAMECONTROLLER GameController)
|
find_library(GAMECONTROLLER GameController)
|
||||||
|
@ -2171,27 +2162,23 @@ elseif(APPLE)
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_METAL)
|
if(SDL_FRAMEWORK_METAL)
|
||||||
if(IOS OR TVOS)
|
if(IOS OR TVOS)
|
||||||
find_library(METAL Metal)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Metal")
|
||||||
list(APPEND EXTRA_LIBS ${METAL})
|
|
||||||
else()
|
else()
|
||||||
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal")
|
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_OPENGLES)
|
if(SDL_FRAMEWORK_OPENGLES)
|
||||||
find_library(OPENGLES OpenGLES)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,OpenGLES")
|
||||||
list(APPEND EXTRA_LIBS ${OPENGLES})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_QUARTZCORE)
|
if(SDL_FRAMEWORK_QUARTZCORE)
|
||||||
if(IOS OR TVOS)
|
if(IOS OR TVOS)
|
||||||
find_library(QUARTZCORE QuartzCore)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,QuartzCore")
|
||||||
list(APPEND EXTRA_LIBS ${QUARTZCORE})
|
|
||||||
else()
|
else()
|
||||||
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore")
|
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_UIKIT)
|
if(SDL_FRAMEWORK_UIKIT)
|
||||||
find_library(UIKIT UIKit)
|
list(APPEND EXTRA_LDFLAGS "-Wl,-framework,UIKit")
|
||||||
list(APPEND EXTRA_LIBS ${UIKIT})
|
|
||||||
endif()
|
endif()
|
||||||
if(SDL_FRAMEWORK_COREHAPTICS)
|
if(SDL_FRAMEWORK_COREHAPTICS)
|
||||||
find_library(COREHAPTICS CoreHaptics)
|
find_library(COREHAPTICS CoreHaptics)
|
||||||
|
|
Loading…
Reference in New Issue