CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE
INSTALL_COMMAND ""
)
-if(WIN32)
- set(CODEC2_LIBRARIES
- ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/codec2.lib)
-else(WIN32)
- set(CODEC2_LIBRARIES
- ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/libcodec2.a)
+set(CODEC2_LIBRARIES
+ ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/libcodec2.a)
endif(WIN32)
include_directories(${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2/src)
list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARIES})
#
-if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+if(PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
# in cache already
set(PORTAUDIO_FOUND TRUE)
-else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
- if (NOT WIN32)
+else(PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+ if(NOT WIN32 OR (MINGW AND CMAKE_CROSSCOMPILING))
include(FindPkgConfig)
pkg_check_modules(PORTAUDIO2 portaudio-2.0)
- endif (NOT WIN32)
+ endif()
- if (PORTAUDIO2_FOUND)
- set(PORTAUDIO_INCLUDE_DIRS
- ${PORTAUDIO2_INCLUDE_DIRS}
- )
- if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(PORTAUDIO2_FOUND)
+
+ set(PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO2_INCLUDE_DIRS})
+ 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
- )
+ else()
+ # CMake prefers absolute library paths.
+ foreach(_lib portaudio-2;${PORTAUDIO2_LIBRARIES})
+ find_library(${_lib}_LIB ${_lib} {PORTAUDIO2_LIBDIR})
+ if(${_lib}_LIB)
+ list(APPEND PORTAUDIO_LIBRARIES ${${_lib}_LIB})
+ endif()
+ endforeach()
+ endif()
+ set(PORTAUDIO_VERSION 19)
set(PORTAUDIO_FOUND TRUE)
- else (PORTAUDIO2_FOUND)
+
+ else(PORTAUDIO2_FOUND)
+
find_path(PORTAUDIO_INCLUDE_DIR
NAMES
portaudio.h
NAMES
portaudio
PATHS
+ ${CMAKE_SYSTEM_LIBRARY_PATH}
+ ${CMAKE_LIBRARY_PATH}
/usr/lib
/usr/local/lib
/opt/local/lib