[vlc-commits] commit: Use a more clever libVLC finder. (Jean-Baptiste Kempf )
git at videolan.org
git at videolan.org
Sat Mar 13 17:53:44 CET 2010
vlc/phonon | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Mar 13 17:52:00 2010 +0100| [8f16c29dfc1b921ba2a2f89028a8b012eb37f83a] | committer: Jean-Baptiste Kempf
Use a more clever libVLC finder.
Borrowed from VLMC
> http://git.videolan.org/gitweb.cgi/vlc/phonon.git/?a=commit;h=8f16c29dfc1b921ba2a2f89028a8b012eb37f83a
---
CMakeLists.txt | 2 +-
cmake/modules/FindLIBVLC.cmake | 67 ++++++++++++++++++++++++++++++++++++++++
cmake/modules/FindVLC.cmake | 20 ++++++------
vlc/CMakeLists.txt | 2 +-
4 files changed, 79 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb8956d..71d7a36 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,7 +34,7 @@ find_package(Phonon REQUIRED)
if(PHONON_PULSESUPPORT)
add_definitions(-DPHONON_PULSESUPPORT)
endif(PHONON_PULSESUPPORT)
-find_package(VLC REQUIRED)
+find_package(LIBVLC REQUIRED)
if (NOT AUTOMOC4_VERSION)
set(AUTOMOC4_VERSION "0.9.83")
endif (NOT AUTOMOC4_VERSION)
diff --git a/cmake/modules/FindLIBVLC.cmake b/cmake/modules/FindLIBVLC.cmake
new file mode 100644
index 0000000..b312cd6
--- /dev/null
+++ b/cmake/modules/FindLIBVLC.cmake
@@ -0,0 +1,67 @@
+
+# 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
+ "$ENV{LIBVLC_INCLUDE_PATH}"
+ "$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
+ NO_DEFAULT_PATH
+ )
+FIND_PATH(LIBVLC_INCLUDE_DIR vlc.h)
+
+#Put here path to custom location
+#example: /home/user/vlc/lib etc..
+FIND_LIBRARY(LIBVLC_LIBRARY NAMES vlc PATHS
+ "$ENV{LIBVLC_LIBRARY_PATH}"
+ "$ENV{LIB_DIR}/lib"
+ #mingw
+ c:/msys/local/lib
+ NO_DEFAULT_PATH
+ )
+FIND_LIBRARY(LIBVLC_LIBRARY NAMES vlc)
+FIND_LIBRARY(LIBVLCCORE_LIBRARY NAMES vlccore PATHS
+ "$ENV{LIBVLC_LIBRARY_PATH}"
+ "$ENV{LIB_DIR}/lib"
+ #mingw
+ c:/msys/local/lib
+ NO_DEFAULT_PATH
+ )
+FIND_LIBRARY(LIBVLCCORE_LIBRARY NAMES vlccore)
+
+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)
+ 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/cmake/modules/FindVLC.cmake b/cmake/modules/FindVLC.cmake
index 351907f..faa4915 100644
--- a/cmake/modules/FindVLC.cmake
+++ b/cmake/modules/FindVLC.cmake
@@ -23,15 +23,15 @@ set( VLC_VERSION_OK = True )
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
-if(NOT WIN32)
- find_package(PkgConfig)
- pkg_check_modules(VLC libvlc>=1.1.0)
- set(VLC_DEFINITIONS ${VLC_CFLAGS})
- set(VLC_LIBRARIES ${VLC_LDFLAGS})
- # TODO add argument support to pass version on find_package
- include(MacroEnsureVersion)
- macro_ensure_version(1.1.0 ${VLC_VERSION} VLC_VERSION_OK)
-endif(NOT WIN32)
+#if(NOT WIN32)
+# find_package(PkgConfig)
+# pkg_check_modules(VLC libvlc>=1.1.0)
+# set(VLC_DEFINITIONS ${VLC_CFLAGS})
+# set(VLC_LIBRARIES ${VLC_LDFLAGS})
+# # TODO add argument support to pass version on find_package
+# include(MacroEnsureVersion)
+# macro_ensure_version(1.1.0 ${VLC_VERSION} VLC_VERSION_OK)
+#endif(NOT WIN32)
if(VLC_VERSION_OK)
@@ -44,7 +44,7 @@ endif(VLC_VERSION_OK)
find_path(VLC_INCLUDE_DIR
NAMES vlc.h
- PATHS ${VLC_INCLUDE_DIRS}
+ PATHS ${VLC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/../../include/vlc/
PATH_SUFFIXES vlc)
find_library(VLC_LIBRARIES
diff --git a/vlc/CMakeLists.txt b/vlc/CMakeLists.txt
index 24b986a..1909a9a 100644
--- a/vlc/CMakeLists.txt
+++ b/vlc/CMakeLists.txt
@@ -26,7 +26,7 @@ automoc4(phonon_vlc phonon_vlc_SRCS)
add_library(phonon_vlc MODULE ${phonon_vlc_SRCS})
set_target_properties(phonon_vlc PROPERTIES PREFIX "")
-target_link_libraries(phonon_vlc ${PHONON_LIBS} ${VLC_LIBRARIES})
+target_link_libraries(phonon_vlc ${PHONON_LIBS} ${LIBVLC_LIBRARIES})
if(WIN32)
install(TARGETS phonon_vlc DESTINATION bin/phonon_backend)
More information about the vlc-commits
mailing list