aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2024-05-12 13:41:57 +1000
committerfuzzard <fuzzard@kodi.tv>2024-06-22 13:17:14 +1000
commit489a7fcdd24f8002a44debd4ca7402ce6dcad384 (patch)
tree12b24eecee045734f1256c9b889fbe13c30f212c /cmake
parent7236765e06325461589584e5b7e074681224a76e (diff)
[cmake][modules] FindPulseAudio cleanup and use core_target_link_libraries
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindPulseAudio.cmake64
-rw-r--r--cmake/scripts/linux/Install.cmake2
2 files changed, 30 insertions, 36 deletions
diff --git a/cmake/modules/FindPulseAudio.cmake b/cmake/modules/FindPulseAudio.cmake
index 4d480ba6e5..907a7f952e 100644
--- a/cmake/modules/FindPulseAudio.cmake
+++ b/cmake/modules/FindPulseAudio.cmake
@@ -3,44 +3,40 @@
# --------------
# Finds the PulseAudio library
#
-# This will define the following target:
+# This will define the following targets:
#
-# PulseAudio::PulseAudio - The PulseAudio library
-# PulseAudio::PulseAudioSimple - The PulseAudio simple library
-# PulseAudio::PulseAudioMainloop - The PulseAudio mainloop library
+# ${APP_NAME_LC}::PulseAudio - The PulseAudio library
+# ${APP_NAME_LC}::PulseAudioSimple - The PulseAudio simple library
+# ${APP_NAME_LC}::PulseAudioMainloop - The PulseAudio mainloop library
-if(NOT TARGET PulseAudio::PulseAudio)
-
- if(PulseAudio_FIND_VERSION)
- if(PulseAudio_FIND_VERSION_EXACT)
- set(PulseAudio_FIND_SPEC "=${PulseAudio_FIND_VERSION_COMPLETE}")
- else()
- set(PulseAudio_FIND_SPEC ">=${PulseAudio_FIND_VERSION_COMPLETE}")
- endif()
- endif()
+if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
+ if(PulseAudio_FIND_VERSION)
+ if(PulseAudio_FIND_VERSION_EXACT)
+ set(PulseAudio_FIND_SPEC "=${PulseAudio_FIND_VERSION_COMPLETE}")
+ else()
+ set(PulseAudio_FIND_SPEC ">=${PulseAudio_FIND_VERSION_COMPLETE}")
+ endif()
+ endif()
+
pkg_check_modules(PC_PULSEAUDIO libpulse${PulseAudio_FIND_SPEC} QUIET)
pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib${PulseAudio_FIND_SPEC} QUIET)
pkg_check_modules(PC_PULSEAUDIO_SIMPLE libpulse-simple${PulseAudio_FIND_SPEC} QUIET)
endif()
find_path(PULSEAUDIO_INCLUDE_DIR NAMES pulse/pulseaudio.h pulse/simple.h
- HINTS ${PC_PULSEAUDIO_INCLUDEDIR} ${PC_PULSEAUDIO_INCLUDE_DIRS}
- NO_CACHE)
+ HINTS ${PC_PULSEAUDIO_INCLUDEDIR} ${PC_PULSEAUDIO_INCLUDE_DIRS})
find_library(PULSEAUDIO_LIBRARY NAMES pulse libpulse
- HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS}
- NO_CACHE)
+ HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS})
find_library(PULSEAUDIO_SIMPLE_LIBRARY NAMES pulse-simple libpulse-simple
- HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS}
- NO_CACHE)
+ HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS})
find_library(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib
- HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS}
- NO_CACHE)
+ HINTS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS})
if(PC_PULSEAUDIO_VERSION)
set(PULSEAUDIO_VERSION_STRING ${PC_PULSEAUDIO_VERSION})
@@ -59,21 +55,19 @@ if(NOT TARGET PulseAudio::PulseAudio)
list(APPEND AUDIO_BACKENDS_LIST "pulseaudio")
set(AUDIO_BACKENDS_LIST ${AUDIO_BACKENDS_LIST} PARENT_SCOPE)
- add_library(PulseAudio::PulseAudioSimple UNKNOWN IMPORTED)
- set_target_properties(PulseAudio::PulseAudioSimple PROPERTIES
- IMPORTED_LOCATION "${PULSEAUDIO_SIMPLE_LIBRARY}")
-
- add_library(PulseAudio::PulseAudioMainloop UNKNOWN IMPORTED)
- set_target_properties(PulseAudio::PulseAudioMainloop PROPERTIES
- IMPORTED_LOCATION "${PULSEAUDIO_MAINLOOP_LIBRARY}")
+ add_library(${APP_NAME_LC}::PulseAudioSimple UNKNOWN IMPORTED)
+ set_target_properties(${APP_NAME_LC}::PulseAudioSimple PROPERTIES
+ IMPORTED_LOCATION "${PULSEAUDIO_SIMPLE_LIBRARY}")
- add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED)
- set_target_properties(PulseAudio::PulseAudio PROPERTIES
- IMPORTED_LOCATION "${PULSEAUDIO_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIR}"
- INTERFACE_COMPILE_DEFINITIONS HAS_PULSEAUDIO=1
- INTERFACE_LINK_LIBRARIES "PulseAudio::PulseAudioMainloop;PulseAudio::PulseAudioSimple")
+ add_library(${APP_NAME_LC}::PulseAudioMainloop UNKNOWN IMPORTED)
+ set_target_properties(${APP_NAME_LC}::PulseAudioMainloop PROPERTIES
+ IMPORTED_LOCATION "${PULSEAUDIO_MAINLOOP_LIBRARY}")
- set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP PulseAudio::PulseAudio)
+ add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
+ set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
+ IMPORTED_LOCATION "${PULSEAUDIO_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAS_PULSEAUDIO
+ INTERFACE_LINK_LIBRARIES "${APP_NAME_LC}::PulseAudioMainloop;${APP_NAME_LC}::PulseAudioSimple")
endif()
endif()
diff --git a/cmake/scripts/linux/Install.cmake b/cmake/scripts/linux/Install.cmake
index 47dc8faeef..efe7674b74 100644
--- a/cmake/scripts/linux/Install.cmake
+++ b/cmake/scripts/linux/Install.cmake
@@ -13,7 +13,7 @@ set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC})
# Set XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone
if(EXISTS ${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse)
- if(ENABLE_PULSEAUDIO AND TARGET PulseAudio::PulseAudio)
+ if(ENABLE_PULSEAUDIO AND TARGET ${APP_NAME_LC}::PulseAudio)
file(READ "${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse" pulse_content)
set(XBMC_STANDALONE_SH_PULSE ${pulse_content})
endif()