Skip to content
Permalink
Browse files

changed: do not trust pkg-config values for librtmp

only use them as hints, and validate using find_library / find_path
  • Loading branch information...
akva2 committed Sep 7, 2016
1 parent de93f57 commit 91bb3741d1110d8687c49b3489e9a8b850453dde
Showing with 19 additions and 7 deletions.
  1. +1 −0 CMakeLists.txt
  2. +18 −7 FindRTMP.cmake
@@ -6,6 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})

enable_language(CXX)

find_package(PkgConfig)
find_package(Kodi REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
@@ -6,16 +6,27 @@
# RTMP_LIBRARIES - The librtmp libraries

if(PKG_CONFIG_FOUND)
pkg_check_modules (RTMP librtmp)
list(APPEND RTMP_INCLUDE_DIRS ${RTMP_INCLUDEDIR})
pkg_check_modules (PC_RTMP librtmp QUIET)
endif()

find_path(RTMP_INCLUDE_DIR librtmp/rtmp.h PATHS ${PC_RTMP_INCLUDEDIR})
find_library(RTMP_LIBRARY rtmp PATHS ${PC_RTMP_LIBDIR})

if(PC_RTMP_FOUND)
if(RTMP_LIBRARY)
set(RTMP_LIBRARIES ${PC_RTMP_LIBRARIES})
else()
unset(RTMP_LIBRARIES)
endif()
if(RTMP_INCLUDE_DIR)
set(RTMP_INCLUDE_DIRS ${RTMP_INCLUDE_DIR} ${PC_RTMP_INCLUDE_DIRS})
endif()
else()
find_path(RTMP_INCLUDE_DIRS librtmp/rtmp.h)
find_library(RTMP_LIBRARIES rtmp)
set(RTMP_LIBRARIES ${RTMP_LIBRARY})
set(RTMP_INCLUDE_DIRS ${RTMP_INCLUDE_DIR})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(RTMP DEFAULT_MSG RTMP_INCLUDE_DIRS RTMP_LIBRARIES)

list(APPEND RTMP_DEFINITIONS -DHAS_LIBRTMP=1)

mark_as_advanced(RTMP_INCLUDE_DIRS RTMP_LIBRARIES RTMP_DEFINITIONS)
mark_as_advanced(RTMP_INCLUDE_DIRS RTMP_LIBRARIES)

0 comments on commit 91bb374

Please sign in to comment.
You can’t perform that action at this time.