From d9de26deded4dade494b68dee356b607cbb6fefe Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Thu, 13 Nov 2014 19:51:15 +0000 Subject: [PATCH] Fix library reference in BuildCodec2.cmake git-svn-id: https://svn.code.sf.net/p/freetel/code@1937 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/cmake/BuildCodec2.cmake | 8 ++----- fdmdv2/cmake/FindPortaudio.cmake | 41 ++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/fdmdv2/cmake/BuildCodec2.cmake b/fdmdv2/cmake/BuildCodec2.cmake index f56a186b..bdb52505 100644 --- a/fdmdv2/cmake/BuildCodec2.cmake +++ b/fdmdv2/cmake/BuildCodec2.cmake @@ -4,12 +4,8 @@ ExternalProject_Add(codec2 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}) diff --git a/fdmdv2/cmake/FindPortaudio.cmake b/fdmdv2/cmake/FindPortaudio.cmake index 158e20ee..9eca1d03 100644 --- a/fdmdv2/cmake/FindPortaudio.cmake +++ b/fdmdv2/cmake/FindPortaudio.cmake @@ -14,31 +14,34 @@ # -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 @@ -63,6 +66,8 @@ else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) NAMES portaudio PATHS + ${CMAKE_SYSTEM_LIBRARY_PATH} + ${CMAKE_LIBRARY_PATH} /usr/lib /usr/local/lib /opt/local/lib -- 2.25.1