2012-05-13 00:36:44 +02:00
2012-05-12 22:33:18 +02:00
# CMake module to search for LIBVLC (VLC library)
2012-05-13 00:36:44 +02:00
# Authors: Rohit Yadav <rohityadav89@gmail.com>
# Harald Sitter <apachelogger@ubuntu.com>
2012-05-12 22:33:18 +02:00
#
# If it's found it sets LIBVLC_FOUND to TRUE
# and following variables are set:
# LIBVLC_INCLUDE_DIR
# LIBVLC_LIBRARY
2012-05-13 00:36:44 +02:00
# LIBVLC_VERSION
2012-05-14 17:57:50 +02:00
# LIBVLC_VERSION_PRE_V2
2012-05-28 18:15:30 +02:00
# LIBVLC_VERSION_PRE_1_1_0
2012-05-12 22:33:18 +02:00
2012-05-13 00:36:44 +02:00
if ( NOT LIBVLC_MIN_VERSION )
set ( LIBVLC_MIN_VERSION "0.0" )
endif ( NOT LIBVLC_MIN_VERSION )
2012-05-12 22:33:18 +02:00
2012-05-13 00:36:44 +02:00
# find_path and find_library normally search standard locations
2012-05-12 22:33:18 +02:00
# 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.
2012-05-13 00:36:44 +02:00
if ( NOT WIN32 )
find_package ( PkgConfig )
pkg_check_modules ( PC_LIBVLC libvlc )
set ( LIBVLC_DEFINITIONS ${ PC_LIBVLC_CFLAGS_OTHER } )
endif ( NOT WIN32 )
2012-05-12 22:33:18 +02:00
#Put here path to custom location
#example: /home/user/vlc/include etc..
2012-05-13 00:36:44 +02:00
find_path ( LIBVLC_INCLUDE_DIR vlc/vlc.h
H I N T S " $ E N V { L I B V L C _ I N C L U D E _ P A T H } "
P A T H S
2012-05-12 22:33:18 +02:00
" $ E N V { L I B _ D I R } / i n c l u d e "
" $ E N V { L I B _ D I R } / i n c l u d e / v l c "
" / u s r / i n c l u d e "
" / u s r / i n c l u d e / v l c "
" / u s r / l o c a l / i n c l u d e "
" / u s r / l o c a l / i n c l u d e / v l c "
#mingw
c : / m s y s / l o c a l / i n c l u d e
2012-05-13 00:36:44 +02:00
)
find_path ( LIBVLC_INCLUDE_DIR PATHS "${CMAKE_INCLUDE_PATH}/vlc" NAMES vlc.h
H I N T S $ { P C _ L I B V L C _ I N C L U D E D I R } $ { P C _ L I B V L C _ I N C L U D E _ D I R S } )
2012-05-12 22:33:18 +02:00
2015-11-20 20:09:39 +01:00
if ( WANT_USE_VLC AND NOT LIBVLC_FIND_QUIETLY )
2015-11-16 23:55:03 +01:00
message ( STATUS "Found LibVLC include-dir path: [${LIBVLC_INCLUDE_DIR}]" )
2015-11-20 20:09:39 +01:00
endif ( )
2015-11-16 23:55:03 +01:00
2012-05-16 07:46:04 +02:00
# dream on libvlc doesn't support static linking
set ( LIBVLC_LIB_NAMES vlc libvlc )
set ( LIBVLC_LIB_CORE_NAMES vlccore libvlccore )
2012-05-16 08:32:41 +02:00
#IF(WANT_STATIC_LIBS)
# set(LIBVLC_LIB_NAMES libvlc.a ${LIBVLC_LIB_NAMES})
# set(LIBVLC_LIB_CORE_NAMES libvlccore.a ${LIBVLC_LIB_CORE_NAMES})
2012-05-16 07:46:04 +02:00
2012-05-16 08:32:41 +02:00
# message(STATUS "Looking for LIBVLC static libs")
#ENDIF()
2012-05-16 07:46:04 +02:00
2012-05-12 22:33:18 +02:00
#Put here path to custom location
#example: /home/user/vlc/lib etc..
2012-05-16 07:46:04 +02:00
find_library ( LIBVLC_LIBRARY NAMES ${ LIBVLC_LIB_NAMES }
2012-05-13 00:36:44 +02:00
H I N T S " $ E N V { L I B V L C _ L I B R A R Y _ P A T H } " $ { P C _ L I B V L C _ L I B D I R } $ { P C _ L I B V L C _ L I B R A R Y _ D I R S }
P A T H S
2012-05-12 22:33:18 +02:00
" $ E N V { L I B _ D I R } / l i b "
#mingw
c : / m s y s / l o c a l / l i b
2012-05-13 00:36:44 +02:00
)
2012-05-16 07:46:04 +02:00
find_library ( LIBVLC_LIBRARY NAMES ${ LIBVLC_LIB_NAMES } )
2015-11-16 23:55:03 +01:00
2015-11-20 20:09:39 +01:00
if ( WANT_USE_VLC AND NOT LIBVLC_FIND_QUIETLY )
2015-11-16 23:55:03 +01:00
message ( STATUS "Found LibVLC library path: [${LIBVLC_LIBRARY}]" )
2015-11-20 20:09:39 +01:00
endif ( )
2015-11-16 23:55:03 +01:00
2012-05-16 07:46:04 +02:00
find_library ( LIBVLCCORE_LIBRARY NAMES ${ LIBVLC_LIB_CORE_NAMES }
2012-05-13 00:36:44 +02:00
H I N T S " $ E N V { L I B V L C _ L I B R A R Y _ P A T H } " $ { P C _ L I B V L C _ L I B D I R } $ { P C _ L I B V L C _ L I B R A R Y _ D I R S }
P A T H S
2012-05-12 22:33:18 +02:00
" $ E N V { L I B _ D I R } / l i b "
#mingw
c : / m s y s / l o c a l / l i b
2012-05-13 00:36:44 +02:00
)
2012-05-16 07:46:04 +02:00
find_library ( LIBVLCCORE_LIBRARY NAMES ${ LIBVLC_LIB_CORE_NAMES } )
2012-05-13 00:36:44 +02:00
2015-11-20 20:09:39 +01:00
if ( WANT_USE_VLC AND NOT LIBVLC_FIND_QUIETLY )
2015-11-16 23:55:03 +01:00
message ( STATUS "Found LibVLCcore library path: [${LIBVLCCORE_LIBRARY}]" )
2015-11-20 20:09:39 +01:00
endif ( )
2015-11-16 23:55:03 +01:00
2012-05-13 00:36:44 +02:00
set ( LIBVLC_VERSION ${ PC_LIBVLC_VERSION } )
if ( NOT LIBVLC_VERSION )
2012-11-15 08:50:43 +01:00
# implement means to detect version on windows (vlc --version && regex? ... ultimately we would get it from a header though...)
2012-05-13 00:36:44 +02:00
endif ( NOT LIBVLC_VERSION )
if ( LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY )
set ( LIBVLC_FOUND TRUE )
endif ( LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY )
2012-05-12 22:33:18 +02:00
2012-05-13 00:36:44 +02:00
if ( LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}" )
message ( WARNING "LibVLC version not found: version searched: ${LIBVLC_MIN_VERSION}, found ${LIBVLC_VERSION}\nUnless you are on Windows this is bound to fail." )
2013-09-18 21:03:12 +02:00
# only activate once version detection can be guaranteed (which is currently not the case on windows)
2012-05-13 00:36:44 +02:00
# set(LIBVLC_FOUND FALSE)
endif ( LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}" )
2012-05-12 22:33:18 +02:00
2012-05-13 00:36:44 +02:00
if ( LIBVLC_FOUND )
2012-05-14 17:57:50 +02:00
if ( LIBVLC_VERSION STRLESS "2.0.0" )
set ( LIBVLC_VERSION_PRE_V2 TRUE )
ENDIF ( )
2012-05-28 18:15:30 +02:00
if ( LIBVLC_VERSION STRLESS "1.1.0" )
set ( LIBVLC_VERSION_PRE_1_1_0 TRUE )
2012-05-14 23:09:44 +02:00
ENDIF ( )
2012-05-14 17:57:50 +02:00
2012-05-13 00:36:44 +02:00
if ( NOT LIBVLC_FIND_QUIETLY )
message ( STATUS "Found LibVLC version: ${LIBVLC_VERSION} (searched for: ${LIBVLC_MIN_VERSION})" )
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 )
2012-05-12 22:33:18 +02:00
2015-06-14 19:23:53 +02:00
MARK_AS_ADVANCED ( LIBVLCCORE_LIBRARY LIBVLC_INCLUDE_DIR LIBVLC_LIBRARY )