1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 06:09:47 +02:00
audacity/cmake-proxies/ffmpeg/CMakeLists.txt
Leland Lucius 53840f7a3e Various fixes to CMake build
Mostly a result of not defining __WXMSW__, but the portmixer cmakelist
wasn't looking for the right portaudio variables.
2020-02-19 10:53:50 -06:00

69 lines
2.0 KiB
CMake

# Add our target and all of it's aliases
add_library( ${TARGET} INTERFACE )
add_library( ${symbol} ALIAS ${TARGET} )
add_library( libavcodec ALIAS ${TARGET} )
add_library( libavformat ALIAS ${TARGET} )
add_library( libavutil ALIAS ${TARGET} )
# Pull in standard variables
def_vars()
message( STATUS "========== Configuring ${name} ==========" )
# We can only (possibly) link to it if we have pkg-config
if( PkgConfig_FOUND )
set( opt "linked" )
set( desc "linked, " )
endif()
# FFmpeg is either dynamically loaded, linked to, or off
cmd_option( ${_OPT}use_ffmpeg
"Use ffmpeg library [loaded, ${desc}off]"
"loaded"
STRINGS "loaded" ${opt} "off"
)
# Deteremine if it will be turned off, linked to, or loaded
if( ${_OPT}use_ffmpeg STREQUAL "off" )
message( STATUS "Disabling '${name}' library" )
else()
# Let the Audacity target know that this library will be used.
set( USE_${symbol} ON CACHE INTERNAL "" )
# Only need to look up the package if we're linking to it
set( isdyn YES )
if( ${_OPT}use_ffmpeg STREQUAL "linked" )
pkg_check_modules( ${TARGET} ${packages} )
# Set up for link if it was found
if( ${TARGET}_FOUND )
message( STATUS "Linking '${name}' library during build" )
# Pull in the package settings
get_package_interface( ${TARGET} )
# Not dynamic
set( isdyn NO )
endif()
endif()
# Pull in the local includes if we're dynamically loading
if( isdyn )
message( STATUS "Will dynamically load '${name}' library at runtime" )
list( APPEND INCLUDES
INTERFACE
${TARGET_ROOT}
)
endif()
endif()
# And add the settings to the target
target_include_directories( ${TARGET} INTERFACE ${INCLUDES} )
target_compile_options( ${TARGET} INTERFACE ${COPTS} )
target_link_directories( ${TARGET} INTERFACE ${LINKDIRS} )
target_link_options( ${TARGET} INTERFACE ${LOPTS} )
target_link_libraries( ${TARGET} INTERFACE ${LIBRARIES} )