[vlmc-devel] Use pkg-config to locate libvlc
Hugo Beauzée-Luyssen
git at videolan.org
Tue May 24 00:37:16 CEST 2016
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue May 24 00:29:48 2016 +0200| [afcf7f28701f0b559c2ddbf64e1f3bdc3bd3ecfc] | committer: Hugo Beauzée-Luyssen
Use pkg-config to locate libvlc
> https://code.videolan.org/videolan/vlmc/commit/afcf7f28701f0b559c2ddbf64e1f3bdc3bd3ecfc
---
cmake/FindLIBVLC.cmake | 88 --------------------------------------------------
src/CMakeLists.txt | 14 ++++++--
2 files changed, 11 insertions(+), 91 deletions(-)
diff --git a/cmake/FindLIBVLC.cmake b/cmake/FindLIBVLC.cmake
deleted file mode 100644
index 48f1914..0000000
--- a/cmake/FindLIBVLC.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-
-# CMake module to search for LIBVLC (VLC library)
-# Author: Rohit Yadav <rohityadav89 at gmail.com>
-#
-# If it's found it sets LIBVLC_FOUND to TRUE
-# and following variables are set:
-# LIBVLC_INCLUDE_DIR
-# LIBVLC_LIBRARY
-
-
-# FIND_PATH and FIND_LIBRARY normally search standard locations
-# before the specified paths. To search non-standard paths first,
-# FIND_* is invoked first with specified paths and NO_DEFAULT_PATH
-# and then again with no specified paths to search the default
-# locations. When an earlier FIND_* succeeds, subsequent FIND_*s
-# searching for the same item do nothing.
-
-#Put here path to custom location
-#example: /home/user/vlc/include etc..
-FIND_PATH(LIBVLC_INCLUDE_DIR vlc/vlc.h
- HINTS "$ENV{LIBVLC_INCLUDE_PATH}"
- PATHS
- #Mac OS and Contribs
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/include"
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/include/vlc"
- # Env
- "$ENV{LIB_DIR}/include"
- "$ENV{LIB_DIR}/include/vlc"
- #
- "/usr/include"
- "/usr/include/vlc"
- "/usr/local/include"
- "/usr/local/include/vlc"
- #mingw
- c:/msys/local/include
- # Modern Mac locations
- "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/include"
- )
-FIND_PATH(LIBVLC_INCLUDE_DIR PATHS "${CMAKE_INCLUDE_PATH}/vlc" NAMES vlc.h)
-
-#Put here path to custom location
-#example: /home/user/vlc/lib etc..
-FIND_LIBRARY(LIBVLC_LIBRARY NAMES vlc libvlc
- HINTS "$ENV{LIBVLC_LIBRARY_PATH}"
- PATHS
- "$ENV{LIB_DIR}/lib"
- #Mac OS
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/lib"
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/plugins"
- # Modern Mac location
- "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib"
- "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib/vlc"
- #mingw
- c:/msys/local/lib
- )
-FIND_LIBRARY(LIBVLC_LIBRARY NAMES vlc libvlc)
-FIND_LIBRARY(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore
- HINTS "$ENV{LIBVLC_LIBRARY_PATH}"
- PATHS
- "$ENV{LIB_DIR}/lib"
- #Mac OS
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/lib"
- "${CMAKE_CURRENT_SOURCE_DIR}/contribs/plugins"
- # Modern Mac location
- "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib"
- "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib/vlc"
- #mingw
- c:/msys/local/lib
- )
-FIND_LIBRARY(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore)
-
-IF (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
- SET(LIBVLC_FOUND TRUE)
-ENDIF (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
-
-IF (LIBVLC_FOUND)
- get_filename_component(LIBVLC_LIB_DIR ${LIBVLC_LIBRARY} PATH)
- IF (NOT LIBVLC_FIND_QUIETLY)
- MESSAGE(STATUS "Found LibVLC include-dir path: ${LIBVLC_INCLUDE_DIR}")
- MESSAGE(STATUS "Found LibVLC library path:${LIBVLC_LIBRARY}")
- MESSAGE(STATUS "Found LibVLCcore library path:${LIBVLCCORE_LIBRARY}")
- ENDIF (NOT LIBVLC_FIND_QUIETLY)
-ELSE (LIBVLC_FOUND)
- IF (LIBVLC_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find LibVLC")
- ENDIF (LIBVLC_FIND_REQUIRED)
-ENDIF (LIBVLC_FOUND)
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b4fa8ec..76d6d80 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,8 +2,11 @@
# VLMC build system
# Authors: Rohit Yadav <rohityadav89 at gmail.com>
# Ludovic Fauvet <etix at vlmc.org>
+# Hugo Beauzée-Luyssen <hugo at beauzee.fr>
#
+include(FindPkgConfig)
+
if (APPLE)
# Manually set Qt5 path for OSX installed using brew
SET(CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
@@ -20,9 +23,14 @@ if (Qt5Core_FOUND)
endif()
endif()
-FIND_PACKAGE(LIBVLC REQUIRED)
-list(APPEND VLMC_LIBS ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY})
-INCLUDE_DIRECTORIES(${LIBVLC_INCLUDE_DIR})
+# We need to use pkg-config, as the medialibrary will use the pkg-config provided
+# libvlc
+pkg_check_modules(LIBVLC REQUIRED libvlc>=3.0)
+
+# There's a special place in hell for people who use libvlccore in their apps.
+list(APPEND VLMC_LIBS ${LIBVLC_LIBRARIES} vlccore)
+link_directories(${LIBVLC_LIBRARY_DIRS})
+INCLUDE_DIRECTORIES(${LIBVLC_INCLUDE_DIRS})
FIND_PACKAGE(frei0r REQUIRED)
More information about the Vlmc-devel
mailing list