Fix library reference in BuildCodec2.cmake
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 13 Nov 2014 19:51:15 +0000 (19:51 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 13 Nov 2014 19:51:15 +0000 (19:51 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1937 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/cmake/BuildCodec2.cmake
fdmdv2/cmake/FindPortaudio.cmake

index f56a186b8a3d04d5411948d94df14beeaea31382..bdb52505fd58bf6c09f2473e33345ca54b8e094f 100644 (file)
@@ -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})
index 158e20ee582f9461596a2d9286b7a54da6352ef7..9eca1d03a010a26a8393616329760f3612e3078e 100644 (file)
 #
 
 
-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