mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-24 15:23:52 +02:00
Add a find_package fallback for the *system* libs
This is required, as PortMidi does not have package config available
This commit is contained in:
committed by
Dmitry Vedenko
parent
aae3627476
commit
b25e3b767f
@@ -655,11 +655,21 @@ function( addlib dir name symbol required check )
|
||||
# And add it to our target
|
||||
target_include_directories( ${TARGET} INTERFACE ${INCLUDES} )
|
||||
target_link_libraries( ${TARGET} INTERFACE ${LIBRARIES} )
|
||||
elseif( ${_OPT}obey_system_dependencies )
|
||||
message( FATAL_ERROR "Failed to find the system package ${name}" )
|
||||
else()
|
||||
set( ${use} "local" )
|
||||
set_property( CACHE ${use} PROPERTY VALUE "local" )
|
||||
find_package( ${packages} QUIET )
|
||||
|
||||
if( TARGET ${TARGET} )
|
||||
set( PKG_${TARGET}_FOUND Yes )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT PKG_${TARGET}_FOUND )
|
||||
if( ${_OPT}obey_system_dependencies )
|
||||
message( FATAL_ERROR "Failed to find the system package ${name}" )
|
||||
else()
|
||||
set( ${use} "local" )
|
||||
set_property( CACHE ${use} PROPERTY VALUE "local" )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
31
cmake-proxies/cmake-modules/FindPortMidi.cmake
Normal file
31
cmake-proxies/cmake-modules/FindPortMidi.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
#[[
|
||||
A module to look for PortMidi
|
||||
]]
|
||||
|
||||
if( NOT PortMidi_FOUND )
|
||||
find_path( PortMidi_INCLUDE_DIR portmidi.h )
|
||||
find_library( PortMidi_LIBRARIES NAMES portmidi )
|
||||
|
||||
if( PortMidi_INCLUDE_DIR AND PortMidi_LIBRARIES )
|
||||
set( PortMidi_FOUND Yes )
|
||||
endif()
|
||||
|
||||
if( PortMidi_FOUND )
|
||||
if( NOT PortMidi_FIND_QUIETLY )
|
||||
message( STATUS "Found PortMidi: \n\tPortMidi_INCLUDE_DIR: ${PortMidi_INCLUDE_DIR}\n\tPortMidi_LIBRARIES: ${PortMidi_LIBRARIES}" )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET PortMidi::PortMidi )
|
||||
add_library( PortMidi::PortMidi INTERFACE IMPORTED GLOBAL)
|
||||
|
||||
target_include_directories( PortMidi::PortMidi INTERFACE ${PortMidi_INCLUDE_DIR} )
|
||||
target_link_libraries( PortMidi::PortMidi INTERFACE ${PortMidi_LIBRARIES} )
|
||||
|
||||
add_library(portmidi ALIAS PortMidi::PortMidi)
|
||||
endif()
|
||||
else()
|
||||
if( PortMidi_FIND_REQUIRED )
|
||||
message( FATAL_ERROR "Could not find PortMidi")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user