summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-01 19:50:57 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-02-01 19:50:57 (GMT)
commit19d437f2ca70416c4360f276b798d31638ee66f4 (patch)
tree2f1371f97e2dfee5ed3cd49e9d1a9ad53a506946 /Modules
parente3abd669a284c790b6992d217f49c5a8f091117d (diff)
parent1de14ec56e9e384b5da48fa902559a928c6ffec3 (diff)
downloadCMake-19d437f2ca70416c4360f276b798d31638ee66f4.zip
CMake-19d437f2ca70416c4360f276b798d31638ee66f4.tar.gz
CMake-19d437f2ca70416c4360f276b798d31638ee66f4.tar.bz2
Merge topic 'improve-findalsa'
1de14ec FindALSA: support version selection
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindALSA.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index af84f8c..ec6e3a8 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -8,6 +8,7 @@
#
# ALSA_INCLUDE_DIR - where to find asoundlib.h, etc.
# ALSA_LIBRARY - the asound library
+# ALSA_VERSION_STRING - the version of alsa found (since CMake 2.8.8)
#
#=============================================================================
@@ -33,10 +34,19 @@ find_library(ALSA_LIBRARY NAMES asound
DOC "The ALSA (asound) library"
)
+if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/version.h")
+ file(STRINGS "${ALSA_INCLUDE_DIR}/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}")
+ unset(alsa_version_str)
+endif()
+
# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA DEFAULT_MSG ALSA_LIBRARY ALSA_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
+ REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
+ VERSION_VAR ALSA_VERSION_STRING)
if(ALSA_FOUND)
set( ALSA_LIBRARIES ${ALSA_LIBRARY} )