mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-20 04:37:26 -05:00
cmake: fix portaudio linking issue (#103)
This commit is contained in:
@@ -19,88 +19,70 @@ if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
|
|||||||
set(PORTAUDIO_FOUND TRUE)
|
set(PORTAUDIO_FOUND TRUE)
|
||||||
else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
|
else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_check_modules(PORTAUDIO2 portaudio-2.0)
|
pkg_check_modules(PORTAUDIO2 portaudio-2.0)
|
||||||
endif (NOT WIN32)
|
endif (NOT WIN32)
|
||||||
|
|
||||||
if (PORTAUDIO2_FOUND)
|
find_path (PORTAUDIO_INCLUDE_DIRS
|
||||||
set(PORTAUDIO_INCLUDE_DIRS
|
NAMES
|
||||||
${PORTAUDIO2_INCLUDE_DIRS}
|
portaudio.h
|
||||||
)
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBRARY_DIRS}/lib${PORTAUDIO2_LIBRARIES}.dylib")
|
|
||||||
else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
set(PORTAUDIO_LIBRARIES
|
|
||||||
${PORTAUDIO2_LIBRARIES}
|
|
||||||
)
|
|
||||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
set(PORTAUDIO_VERSION
|
|
||||||
19
|
|
||||||
)
|
|
||||||
set(PORTAUDIO_FOUND TRUE)
|
|
||||||
else (PORTAUDIO2_FOUND)
|
|
||||||
find_path(PORTAUDIO_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
portaudio.h
|
|
||||||
PATHS
|
PATHS
|
||||||
|
${PORTAUDIO2_INCLUDEDIR}
|
||||||
/usr/include
|
/usr/include
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
/opt/local/include
|
/opt/local/include
|
||||||
/sw/include
|
/sw/include
|
||||||
)
|
)
|
||||||
|
if (NOT PORTAUDIO_INCLUDE_DIRS)
|
||||||
find_library(PORTAUDIO_LIBRARY
|
set (PORTAUDIO_INCLUDE_DIRS
|
||||||
NAMES
|
${PORTAUDIO2_INCLUDE_DIRS}
|
||||||
portaudio
|
|
||||||
PATHS
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
)
|
)
|
||||||
|
list (APPEND PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO2_INCLUDEDIR})
|
||||||
|
endif (NOT PORTAUDIO_INCLUDE_DIRS)
|
||||||
|
|
||||||
find_path(PORTAUDIO_LIBRARY_DIR
|
find_library (PORTAUDIO_LIBRARIES
|
||||||
NAMES
|
NAMES
|
||||||
portaudio
|
portaudio
|
||||||
PATHS
|
PATHS
|
||||||
/usr/lib
|
${PORTAUDIO2_LIBDIR}
|
||||||
/usr/local/lib
|
/usr/lib
|
||||||
/opt/local/lib
|
/usr/local/lib
|
||||||
/sw/lib
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
if (NOT PORTAUDIO_LIBRARIES)
|
||||||
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBDIR}/lib${PORTAUDIO2_LIBRARIES}.dylib")
|
||||||
|
else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(PORTAUDIO_LIBRARIES
|
||||||
|
${PORTAUDIO2_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
endif (NOT PORTAUDIO_LIBRARIES)
|
||||||
|
|
||||||
set(PORTAUDIO_INCLUDE_DIRS
|
if (PORTAUDIO2_VERSION)
|
||||||
${PORTAUDIO_INCLUDE_DIR}
|
set(PORTAUDIO_VERSION
|
||||||
|
${PORTAUDIO2_VERSION}
|
||||||
)
|
)
|
||||||
set(PORTAUDIO_LIBRARIES
|
else (PORTAUDIO2_VERSION)
|
||||||
${PORTAUDIO_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PORTAUDIO_LIBRARY_DIRS
|
|
||||||
${PORTAUDIO_LIBRARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PORTAUDIO_VERSION
|
set(PORTAUDIO_VERSION
|
||||||
18
|
18
|
||||||
)
|
)
|
||||||
|
endif (PORTAUDIO2_VERSION)
|
||||||
|
|
||||||
if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
|
if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
|
||||||
set(PORTAUDIO_FOUND TRUE)
|
set(PORTAUDIO_FOUND TRUE)
|
||||||
endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
|
endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
|
||||||
|
|
||||||
if (PORTAUDIO_FOUND)
|
if (PORTAUDIO_FOUND)
|
||||||
if (NOT Portaudio_FIND_QUIETLY)
|
if (NOT Portaudio_FIND_QUIETLY)
|
||||||
message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}")
|
message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}")
|
||||||
endif (NOT Portaudio_FIND_QUIETLY)
|
endif (NOT Portaudio_FIND_QUIETLY)
|
||||||
else (PORTAUDIO_FOUND)
|
else (PORTAUDIO_FOUND)
|
||||||
if (Portaudio_FIND_REQUIRED)
|
if (Portaudio_FIND_REQUIRED)
|
||||||
message(FATAL_ERROR "Could not find Portaudio")
|
message(FATAL_ERROR "Could not find Portaudio")
|
||||||
else (Portaudio_FIND_REQUIRED)
|
endif (Portaudio_FIND_REQUIRED)
|
||||||
message(STATUS "Could NOT find Portaudio")
|
endif (PORTAUDIO_FOUND)
|
||||||
endif (Portaudio_FIND_REQUIRED)
|
|
||||||
endif (PORTAUDIO_FOUND)
|
|
||||||
endif (PORTAUDIO2_FOUND)
|
|
||||||
|
|
||||||
|
|
||||||
# show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
|
# show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
|
||||||
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
|
mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
|
||||||
|
|||||||
Reference in New Issue
Block a user