1############################################################################# 2## Kwave - cmake/KwaveLibaudiofileSupport.txt 3## ------------------- 4## begin : Tue May 22 2007 5## copyright : (C) 2007 by Thomas Eschenbacher 6## email : Thomas.Eschenbacher@gmx.de 7############################################################################# 8# 9############################################################################# 10# # 11# Redistribution and use in source and binary forms, with or without # 12# modification, are permitted provided that the following conditions # 13# are met: # 14# # 15# 1. Redistributions of source code must retain the above copyright # 16# notice, this list of conditions and the following disclaimer. # 17# 2. Redistributions in binary form must reproduce the above copyright # 18# notice, this list of conditions and the following disclaimer in the # 19# documentation and/or other materials provided with the distribution. # 20# # 21# For details see the accompanying cmake/COPYING-CMAKE-SCRIPTS file. # 22# # 23############################################################################# 24 25INCLUDE(CheckLibraryExists) 26INCLUDE(FindPkgConfig) 27INCLUDE(UsePkgConfig) 28INCLUDE(CheckTypeSize) 29 30PKG_CHECK_MODULES(LIBAUDIOFILE REQUIRED audiofile>=0.3.0) 31 32############################################################################# 33### check if the system has audiofile.h ### 34 35FIND_PATH(HAVE_AUDIOFILE_H audiofile.h) 36FIND_PATH(HAVE_AFS_VFS_H af_vfs.h) 37 38############################################################################# 39### system libaudiofile can be used & header exists: check for functions ### 40 41IF (HAVE_AUDIOFILE_H AND HAVE_AFS_VFS_H) 42 CHECK_LIBRARY_EXISTS(audiofile afOpenVirtualFile ${LIBAUDIOFILE_LIBDIR} HAVE_AF_OPEN_VIRTUAL_FILE) 43ENDIF (HAVE_AUDIOFILE_H AND HAVE_AFS_VFS_H) 44 45# check for compression types 46SET(CMAKE_EXTRA_INCLUDE_FILES "audiofile.h") 47CHECK_TYPE_SIZE("sizeof(AF_COMPRESSION_FLAC)" AF_COMPRESSION_FLAC) 48CHECK_TYPE_SIZE("sizeof(AF_COMPRESSION_ALAC)" AF_COMPRESSION_ALAC) 49SET(CMAKE_EXTRA_INCLUDE_FILES) 50 51############################################################################# 52### some verbose output of the result ### 53 54IF (HAVE_AF_OPEN_VIRTUAL_FILE) 55 # system libaudiofile is ok and will be used 56 MESSAGE(STATUS "Found libaudiofile") 57ELSE (HAVE_AF_OPEN_VIRTUAL_FILE) 58 # system libaudiofile should be used but is not ok -> FAIL 59 MESSAGE(FATAL_ERROR "system libaudiofile is missing or cannot be used") 60ENDIF (HAVE_AF_OPEN_VIRTUAL_FILE) 61 62SET(HAVE_LIBAUDIOFILE ON) 63 64############################################################################# 65############################################################################# 66