https://github.com/audacity/audacity/pull/4916 https://github.com/audacity/audacity/pull/4917 From b42dfbe2be1994ccfeff449b5c5cbe49994ffb38 Mon Sep 17 00:00:00 2001 From: Matthew White Date: Fri, 14 Jul 2023 21:17:45 +0000 Subject: [PATCH] Add missing Findlibmad.cmake file This fixes compiling against the system installed libmad. --- /dev/null +++ b/cmake-proxies/cmake-modules/Findlibmad.cmake @@ -0,0 +1,35 @@ +#[[ +A module to look for libmad +]] + +if( NOT libmad_FOUND ) + find_path( libmad_INCLUDE_DIR mad.h ) + find_library( libmad_LIBRARIES NAMES mad ) + + if( libmad_INCLUDE_DIR AND libmad_LIBRARIES ) + set( libmad_FOUND Yes ) + endif() + + if( libmad_FOUND ) + if( NOT libmad_FIND_QUIETLY ) + message( STATUS "Found mad: \n\tlibmad_INCLUDE_DIR: ${libmad_INCLUDE_DIR}\n\tlibmad_LIBRARIES: ${libmad_LIBRARIES}" ) + endif() + + if( NOT TARGET libmad::libmad ) + add_library( libmad::libmad INTERFACE IMPORTED GLOBAL) + + target_include_directories( libmad::libmad INTERFACE ${libmad_INCLUDE_DIR} ) + target_link_libraries( libmad::libmad INTERFACE ${libmad_LIBRARIES} ) + endif() + else() + if( libmad_FIND_REQUIRED ) + message( FATAL_ERROR "Could not find libmad") + endif() + endif() + + mark_as_advanced( + libmad_FOUND + libmad_INCLUDE_DIR + libmad_LIBRARIES + ) +endif()