Skip to content

Commit 71eac59

Browse files
committed
Fix FindLibzrtp.cmake header search and add optional bnlib linking (PR #274)
- search for libzrtp/zrtp.h to match the actual #include path used in core/AmZRTP.h and core/AmRtpStream.cpp - optionally find and append libbn (Colin Plumb's big-number library) when it is installed as a separate archive alongside libzrtp - keep libbn optional so builds where bn is bundled into libzrtp still work - use correct CMake keyword NAMES (not NAME) and follow project conventions
1 parent c344a5d commit 71eac59

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

cmake/FindLibzrtp.cmake

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
find_path(LIBZRTP_INCLUDE_DIR
2-
NAMES zrtp
3-
PATHS /usr/local/include /usr/include
4-
)
1+
find_path(LIBZRTP_INCLUDE_DIR libzrtp/zrtp.h)
2+
find_library(LIBZRTP_LIBRARIES NAMES zrtp)
53

6-
find_library(LIBZRTP_LIBRARY
7-
NAME zrtp
8-
PATHS /usr/local/lib /usr/lib
9-
)
4+
# bnlib (Colin Plumb's big-number library) is sometimes installed as a
5+
# separate archive alongside libzrtp. Append it when present.
6+
find_library(LIBBN_LIBRARY NAMES bn)
107

11-
find_library(BN_LIBRARY
12-
NAME bn
13-
PATHS /usr/local/lib /usr/lib
14-
)
15-
16-
17-
if(LIBZRTP_INCLUDE_DIR AND LIBZRTP_LIBRARY AND BN_LIBRARY)
8+
if(LIBZRTP_INCLUDE_DIR AND LIBZRTP_LIBRARIES)
189
set(LIBZRTP_FOUND TRUE)
19-
endif()
10+
endif(LIBZRTP_INCLUDE_DIR AND LIBZRTP_LIBRARIES)
2011

2112
if(LIBZRTP_FOUND)
22-
set( LIBZRTP_LIBRARIES ${LIBZRTP_LIBRARY} ${BN_LIBRARY} )
13+
if(LIBBN_LIBRARY)
14+
list(APPEND LIBZRTP_LIBRARIES ${LIBBN_LIBRARY})
15+
endif(LIBBN_LIBRARY)
2316
if(NOT Libzrtp_FIND_QUIETLY)
24-
message(STATUS "Found libzrtp includes: ${LIBZRTP_INCLUDE_DIR}/zrtp/zrtp.h")
17+
message(STATUS "Found libzrtp includes: ${LIBZRTP_INCLUDE_DIR}/libzrtp/zrtp.h")
2518
message(STATUS "Found libzrtp library: ${LIBZRTP_LIBRARIES}")
2619
endif(NOT Libzrtp_FIND_QUIETLY)
2720
else(LIBZRTP_FOUND)

0 commit comments

Comments
 (0)