Some Build Fixes

This commit is contained in:
Florian Märkl 2019-08-18 18:22:51 +02:00
commit 43ddf619ed
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
3 changed files with 23 additions and 20 deletions

View file

@ -46,14 +46,20 @@ function (_ffmpeg_find component headername)
if(PKG_CONFIG_FOUND)
pkg_check_modules(FFMPEG_${component} lib${component} IMPORTED_TARGET)
if(FFMPEG_${component}_FOUND)
join(FFMPEG_LDFLAGS_STRING " " ${FFMPEG_${component}_LDFLAGS})
string(REGEX REPLACE "-Wl,-framework,([^ ]+)" "-framework \\1" FFMPEG_LDFLAGS_STRING_CLEAN ${FFMPEG_LDFLAGS_STRING})
string(REGEX MATCHALL "-framework [^ ]+" FFMPEG_FRAMEWORKS ${FFMPEG_LDFLAGS_STRING_CLEAN})
list(APPEND FFMPEG_${component}_LIBRARIES ${FFMPEG_FRAMEWORKS})
set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES
IMPORTED_GLOBAL TRUE
INTERFACE_LINK_DIRECTORIES "${FFMPEG_${component}_LIBRARY_DIRS}"
INTERFACE_LINK_LIBRARIES "${FFMPEG_${component}_LIBRARIES}")
if(APPLE)
join(FFMPEG_LDFLAGS_STRING " " ${FFMPEG_${component}_LDFLAGS})
string(REGEX REPLACE "-Wl,-framework,([^ ]+)" "-framework \\1" FFMPEG_LDFLAGS_STRING_CLEAN ${FFMPEG_LDFLAGS_STRING})
string(REGEX MATCHALL "-framework [^ ]+" FFMPEG_FRAMEWORKS ${FFMPEG_LDFLAGS_STRING_CLEAN})
list(APPEND FFMPEG_${component}_LIBRARIES ${FFMPEG_FRAMEWORKS})
set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES
INTERFACE_LINK_DIRECTORIES "${FFMPEG_${component}_LIBRARY_DIRS}"
INTERFACE_LINK_LIBRARIES "${FFMPEG_${component}_LIBRARIES}"
INTERFACE_LINK_OPTIONS "")
message("set libs to \"${FFMPEG_${component}_LIBRARIES}\"")
message("set lib dirs to \"${FFMPEG_${component}_LIBRARY_DIRS}\"")
message("set lib otps not to \"${FFMPEG_${component}_LDFLAGS}\"")
endif()
set_target_properties(PkgConfig::FFMPEG_${component} PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(FFMPEG::${component} ALIAS PkgConfig::FFMPEG_${component})
return()
endif()
@ -223,17 +229,9 @@ foreach (_ffmpeg_component IN LISTS FFMPEG_FIND_COMPONENTS)
endforeach ()
unset(_ffmpeg_component)
if (FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif ()
if(_ffmpeg_required_vars)
set(_ffmpeg_required_vars REQUIRED_VARS ${_ffmpeg_required_vars})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFMPEG
${_ffmpeg_required_vars}
REQUIRED_VARS FFMPEG_LIBRARIES
VERSION_VAR FFMPEG_VERSION
HANDLE_COMPONENTS)
unset(_ffmpeg_required_vars)

View file

@ -1,8 +1,11 @@
find_package(SDL2 NO_MODULE QUIET)
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
if(SDL2_FOUND AND (NOT TARGET SDL2::SDL2))
add_library(SDL2::SDL2 UNKNOWN IMPORTED GLOBAL)
if(NOT SDL2_LIBDIR)
set(SDL2_LIBDIR "${libdir}")
endif()
find_library(SDL2_LIBRARY SDL2 PATHS "${SDL2_LIBDIR}" NO_DEFAULT_PATH)
if(SDL2_LIBRARY)
set_target_properties(SDL2::SDL2 PROPERTIES