summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-11 20:42:42 +0100
committerColin Guthrie <colin@mageia.org>2011-10-19 23:49:36 +0100
commit743a4d00deb3b556753d2eb8521c187c62f51775 (patch)
treeb2f2a58366847fe3c0f737dbc2235393f37341b9
parentc5050534522e2dd53ede28e4e5071a15937ff9fd (diff)
build-sys: Provide a simple CMake Config setup (similar to pkgconfig)
I'd rather not have to do this, as I don't really see the point in duplicating what is done in pkgconfig, but this is likely the easiest way to avoid nasty hacks.
-rw-r--r--Makefile.am3
-rw-r--r--PulseAudioConfig.cmake.in12
-rw-r--r--PulseAudioConfigVersion.cmake.in11
-rw-r--r--configure.ac11
4 files changed, 37 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index b0107015..8a94a7c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,9 @@ pkgconfig_DATA += \
libpulse-mainloop-glib.pc
endif
+cmakedir = $(libdir)/cmake/PulseAudio
+cmake_DATA = PulseAudioConfig.cmake PulseAudioConfigVersion.cmake
+
homepage: all dist doxygen
test -d $$HOME/homepage/private
mkdir -p $$HOME/homepage/private/projects/pulseaudio $$HOME/homepage/private/projects/pulseaudio/doxygen
diff --git a/PulseAudioConfig.cmake.in b/PulseAudioConfig.cmake.in
new file mode 100644
index 00000000..191eb679
--- /dev/null
+++ b/PulseAudioConfig.cmake.in
@@ -0,0 +1,12 @@
+set(PULSEAUDIO_FOUND TRUE)
+
+set(PULSEAUDIO_VERSION_MAJOR @PA_MAJOR@)
+set(PULSEAUDIO_VERSION_MINOR @PA_MINOR@)
+set(PULSEAUDIO_VERSION @PA_MAJOR@.@PA_MINOR@)
+set(PULSEAUDIO_VERSION_STRING "@PA_MAJOR@.@PA_MINOR@")
+
+find_path(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h HINTS "@PA_INCDIR@")
+find_library(PULSEAUDIO_LIBRARY NAMES pulse libpulse HINTS "@PA_LIBDIR@")
+ifelse(@HAVE_GLIB20@, 1, dnl
+find_library(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop-glib libpulse-mainloop-glib HINTS "@PA_LIBDIR@")
+)dnl
diff --git a/PulseAudioConfigVersion.cmake.in b/PulseAudioConfigVersion.cmake.in
new file mode 100644
index 00000000..e2947de4
--- /dev/null
+++ b/PulseAudioConfigVersion.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION @PA_MAJOR@.@PA_MINOR@)
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+
diff --git a/configure.ac b/configure.ac
index 0bf40a83..6b358cb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -776,6 +776,7 @@ AS_IF([test "x$enable_glib2" = "xyes" && test "x$HAVE_GLIB20" = "x0"],
AC_SUBST(GLIB20_CFLAGS)
AC_SUBST(GLIB20_LIBS)
+AC_SUBST(HAVE_GLIB20)
AM_CONDITIONAL([HAVE_GLIB20], [test "x$HAVE_GLIB20" = x1])
AS_IF([test "x$HAVE_GLIB20" = "x1"], AC_DEFINE([HAVE_GLIB], 1, [Have GLIB?]))
@@ -1246,6 +1247,16 @@ AC_CONFIG_FILES([src/default.pa:src/daemon/default.pa.in],
AC_CONFIG_FILES([src/system.pa:src/daemon/system.pa.in],
[m4 src/system.pa > src/system.pa.gen && mv src/system.pa.gen src/system.pa])
+# CMake related ProjectConfig files
+PA_LIBDIR="$libdir"
+AX_DEFINE_DIR(PA_LIBDIR, PA_LIBDIR, [PulseAudio library dir])
+PA_INCDIR="$includedir"
+AX_DEFINE_DIR(PA_INCDIR, PA_INCDIR, [PulseAudio include dir])
+
+AC_CONFIG_FILES([PulseAudioConfig.cmake:PulseAudioConfig.cmake.in],
+ [m4 PulseAudioConfig.cmake > PulseAudioConfig.cmake.gen && mv PulseAudioConfig.cmake.gen PulseAudioConfig.cmake])
+AC_CONFIG_FILES([PulseAudioConfigVersion.cmake])
+
AC_OUTPUT
# ==========================================================================