WSJT-X/CMake/Modules/Findportaudio.cmake

51 lines
1.3 KiB
CMake
Raw Normal View History

# - Try to find portaudio
#
# Once done, this will define:
#
# portaudio_FOUND - system has portaudio
# portaudio_VERSION - The version of the portaudio library which was found
#
# and the following imported targets::
#
# portaudio::portaudio - The portaudio library
#
2021-04-13 09:18:26 -04:00
function(dump_cmake_variables)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
endfunction()
include (LibFindMacros)
libfind_pkg_detect (portaudio portaudio-2.0
FIND_PATH portaudio.h
FIND_LIBRARY portaudio
)
libfind_process (portaudio)
2021-04-13 09:18:26 -04:00
dump_cmake_variables ("portaudio")
if (portaudio_FOUND AND NOT TARGET portaudio::portaudio)
add_library (portaudio::portaudio UNKNOWN IMPORTED)
set_target_properties (portaudio::portaudio PROPERTIES
2021-04-13 09:18:26 -04:00
IMPORTED_LOCATION ${portaudio_LIBRARY}
INTERFACE_COMPILE_OPTIONS ${portaudio_PKGCONF_CFLAGS_OTHER}
INTERFACE_INCLUDE_DIRECTORIES ${portaudio_INCLUDE_DIRS}
)
2021-04-13 09:18:26 -04:00
target_link_libraries (portaudio::portaudio INTERFACE ${portaudio_PKGCONF_LDFLAGS})
endif ()
mark_as_advanced (
portaudio_INCLUDE_DIR
portaudio_LIBRARY
)