Warning, /libraries/phonon-vlc/cmake/FindLIBVLC.cmake is written in an unsupported language. File is not indexed.
0001 # CMake module to search for LIBVLC (VLC library) 0002 # 0003 # Copyright (C) 2011-2018, Harald Sitter <sitter@kde.org> 0004 # Copyright (C) 2010, Rohit Yadav <rohityadav89@gmail.com> 0005 # 0006 # Redistribution and use is allowed according to the terms of the BSD license. 0007 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 0008 # 0009 # If it's found it sets LIBVLC_FOUND to TRUE 0010 # and following variables are set: 0011 # LIBVLC_INCLUDE_DIR 0012 # LIBVLC_LIBRARY 0013 # LIBVLC_VERSION 0014 0015 if(NOT LIBVLC_MIN_VERSION) 0016 set(LIBVLC_MIN_VERSION "0.0") 0017 endif(NOT LIBVLC_MIN_VERSION) 0018 0019 # find_path and find_library normally search standard locations 0020 # before the specified paths. To search non-standard paths first, 0021 # FIND_* is invoked first with specified paths and NO_DEFAULT_PATH 0022 # and then again with no specified paths to search the default 0023 # locations. When an earlier FIND_* succeeds, subsequent FIND_*s 0024 # searching for the same item do nothing. 0025 0026 if (NOT WIN32) 0027 find_package(PkgConfig) 0028 pkg_check_modules(PC_LIBVLC libvlc) 0029 set(LIBVLC_DEFINITIONS ${PC_LIBVLC_CFLAGS_OTHER}) 0030 endif (NOT WIN32) 0031 0032 #Put here path to custom location 0033 #example: /home/user/vlc/include etc.. 0034 find_path(LIBVLC_INCLUDE_DIR vlc/vlc.h 0035 HINTS "$ENV{LIBVLC_INCLUDE_PATH}" ${PC_LIBVLC_INCLUDEDIR} ${PC_LIBVLC_INCLUDE_DIRS} 0036 PATHS 0037 "$ENV{LIB_DIR}/include" 0038 "$ENV{LIB_DIR}/include/vlc" 0039 "/usr/include" 0040 "/usr/include/vlc" 0041 "/usr/local/include" 0042 "/usr/local/include/vlc" 0043 #mingw 0044 c:/msys/local/include 0045 ) 0046 find_path(LIBVLC_INCLUDE_DIR PATHS "${CMAKE_INCLUDE_PATH}/vlc" NAMES vlc.h 0047 HINTS ${PC_LIBVLC_INCLUDEDIR} ${PC_LIBVLC_INCLUDE_DIRS}) 0048 0049 #Put here path to custom location 0050 #example: /home/user/vlc/lib etc.. 0051 find_library(LIBVLC_LIBRARY NAMES vlc libvlc 0052 HINTS "$ENV{LIBVLC_LIBRARY_PATH}" ${PC_LIBVLC_LIBDIR} ${PC_LIBVLC_LIBRARY_DIRS} 0053 PATHS 0054 "$ENV{LIB_DIR}/lib" 0055 #mingw 0056 c:/msys/local/lib 0057 ) 0058 find_library(LIBVLC_LIBRARY NAMES vlc libvlc) 0059 find_library(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore 0060 HINTS "$ENV{LIBVLC_LIBRARY_PATH}" ${PC_LIBVLC_LIBDIR} ${PC_LIBVLC_LIBRARY_DIRS} 0061 PATHS 0062 "$ENV{LIB_DIR}/lib" 0063 #mingw 0064 c:/msys/local/lib 0065 ) 0066 find_library(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore) 0067 0068 set(LIBVLC_VERSION ${PC_LIBVLC_VERSION}) 0069 if (NOT LIBVLC_VERSION) 0070 file(READ "${LIBVLC_INCLUDE_DIR}/vlc/libvlc_version.h" _libvlc_version_h) 0071 0072 string(REGEX MATCH "# define LIBVLC_VERSION_MAJOR +\\(([0-9])\\)" _dummy "${_libvlc_version_h}") 0073 set(_version_major "${CMAKE_MATCH_1}") 0074 0075 string(REGEX MATCH "# define LIBVLC_VERSION_MINOR +\\(([0-9])\\)" _dummy "${_libvlc_version_h}") 0076 set(_version_minor "${CMAKE_MATCH_1}") 0077 0078 string(REGEX MATCH "# define LIBVLC_VERSION_REVISION +\\(([0-9])\\)" _dummy "${_libvlc_version_h}") 0079 set(_version_revision "${CMAKE_MATCH_1}") 0080 0081 # Optionally, one could also parse LIBVLC_VERSION_EXTRA, but it does not 0082 # seem to be used by libvlc.pc. 0083 0084 set(LIBVLC_VERSION "${_version_major}.${_version_minor}.${_version_revision}") 0085 endif (NOT LIBVLC_VERSION) 0086 0087 if (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY) 0088 set(LIBVLC_FOUND TRUE) 0089 endif (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY) 0090 0091 if (LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}") 0092 message(WARNING "LibVLC version not found: version searched: ${LIBVLC_MIN_VERSION}, found ${LIBVLC_VERSION}\nUnless you are on Windows this is bound to fail.") 0093 # TODO: only activate once version detection can be garunteed (which is currently not the case on windows) 0094 # set(LIBVLC_FOUND FALSE) 0095 endif (LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}") 0096 0097 if (NOT LIBVLC_FIND_QUIETLY) 0098 message(STATUS "Found LibVLC include-dir path: ${LIBVLC_INCLUDE_DIR}") 0099 message(STATUS "Found LibVLC library path:${LIBVLC_LIBRARY}") 0100 message(STATUS "Found LibVLCcore library path:${LIBVLCCORE_LIBRARY}") 0101 message(STATUS "Found LibVLC version: ${LIBVLC_VERSION} (searched for: ${LIBVLC_MIN_VERSION})") 0102 endif (NOT LIBVLC_FIND_QUIETLY) 0103 0104 if(LIBVLC_FOUND AND NOT TARGET LibVLC::LibVLC) 0105 add_library(LibVLC::LibVLC UNKNOWN IMPORTED) 0106 set_target_properties(LibVLC::LibVLC PROPERTIES 0107 IMPORTED_LOCATION "${LIBVLC_LIBRARY}" 0108 INTERFACE_INCLUDE_DIRECTORIES "${LIBVLC_INCLUDE_DIR}" 0109 ) 0110 endif() 0111 0112 if(LIBVLC_FOUND AND NOT TARGET LibVLC::Core) 0113 add_library(LibVLC::Core UNKNOWN IMPORTED) 0114 set_target_properties(LibVLC::Core PROPERTIES 0115 IMPORTED_LOCATION "${LIBVLCCORE_LIBRARY}" 0116 INTERFACE_INCLUDE_DIRECTORIES "${LIBVLC_INCLUDE_DIR}" 0117 ) 0118 endif()