Fix dependency detection on windows

This commit is contained in:
Tobias Hieta 2015-11-09 15:04:02 +01:00
parent dac7131c5d
commit b65b1a67a1
2 changed files with 48 additions and 44 deletions

View File

@ -3,19 +3,24 @@ option(DISABLE_BUNDLED_DEPS "Disable the bundled deps on certain platforms" OFF)
if(APPLE AND NOT DISABLE_BUNDLED_DEPS)
set(DEFAULT_ROOT "${CMAKE_SOURCE_DIR}/dependencies/konvergo-depends-darwin-x86_64-release")
set(DEPENDENCY_ROOT ${DEFAULT_ROOT} CACHE PATH "Path where the deps are located")
endif(APPLE AND NOT DISABLE_BUNDLED_DEPS)
if(DEPENDENCY_ROOT)
if(WIN32)
set(DEFAULT_ROOT "${CMAKE_SOURCE_DIR}/dependencies/all-deps")
endif(WIN32)
set(DEPENDENCY_ROOT ${DEFAULT_ROOT} CACHE PATH "Path where the deps are located")
if(IS_DIRECTORY ${DEPENDENCY_ROOT})
message(STATUS "Going to use bundled deps in directory: ${DEPENDENCY_ROOT}")
set(CMAKE_FIND_ROOT_PATH ${DEPENDENCY_ROOT})
set(CMAKE_PREFIX_PATH ${DEPENDENCY_ROOT})
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include_directories(${CMAKE_FIND_ROOT_PATH}/include)
else(DEPENDENCY_ROOT)
else(IS_DIRECTORY ${DEPENDENCY_ROOT})
message(STATUS "Not using bundled deps")
endif(DEPENDENCY_ROOT)
endif(IS_DIRECTORY ${DEPENDENCY_ROOT})
find_package(Threads)

View File

@ -21,48 +21,47 @@ SET(_MPV_REQUIRED_VARS MPV_INCLUDE_DIR MPV_LIBRARY)
### MPV uses pkgconfig.
#
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_MPV QUIET mpv)
pkg_check_modules(PC_MPV QUIET mpv)
endif(PKG_CONFIG_FOUND)
if(PC_MPV_FOUND)
#
### Look for the include files.
#
find_path(
MPV_INCLUDE_DIR
NAMES mpv/client.h
HINTS
${PC_MPV_INCLUDEDIR}
${PC_MPV_INCLUDE_DIRS} # Unused for MPV but anyway
DOC "MPV include directory"
)
#
### Look for the libraries
#
set(_MPV_LIBRARY_NAMES mpv)
if(PC_MPV_LIBRARIES)
set(_MPV_LIBRARY_NAMES ${PC_MPV_LIBRARIES})
endif(PC_MPV_LIBRARIES)
#
### Look for the include files.
#
find_path(
MPV_INCLUDE_DIR
NAMES mpv/client.h
HINTS
${PC_MPV_INCLUDEDIR}
${PC_MPV_INCLUDE_DIRS} # Unused for MPV but anyway
DOC "MPV include directory"
)
foreach(l ${_MPV_LIBRARY_NAMES})
find_library(
MPV_LIBRARY_${l}
NAMES ${l}
HINTS
${PC_MPV_LIBDIR}
${PC_MPV_LIBRARY_DIRS} # Unused for MPV but anyway
PATH_SUFFIXES lib${LIB_SUFFIX}
)
list(APPEND MPV_LIBRARY ${MPV_LIBRARY_${l}})
endforeach()
get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
mark_as_advanced(MPV_LIBRARY)
#
### Look for the libraries
#
set(_MPV_LIBRARY_NAMES mpv)
if(PC_MPV_LIBRARIES)
set(_MPV_LIBRARY_NAMES ${PC_MPV_LIBRARIES})
endif(PC_MPV_LIBRARIES)
set(MPV_LIBRARY_DIRS _MPV_LIBRARY_DIR)
list(REMOVE_DUPLICATES MPV_LIBRARY_DIRS)
foreach(l ${_MPV_LIBRARY_NAMES})
find_library(
MPV_LIBRARY_${l}
NAMES ${l}
HINTS
${PC_MPV_LIBDIR}
${PC_MPV_LIBRARY_DIRS} # Unused for MPV but anyway
PATH_SUFFIXES lib${LIB_SUFFIX}
)
list(APPEND MPV_LIBRARY ${MPV_LIBRARY_${l}})
endforeach()
endif()
get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
mark_as_advanced(MPV_LIBRARY)
set(MPV_LIBRARY_DIRS _MPV_LIBRARY_DIR)
list(REMOVE_DUPLICATES MPV_LIBRARY_DIRS)
mark_as_advanced(MPV_INCLUDE_DIR)
mark_as_advanced(MPV_LIBRARY_DIRS)
@ -73,8 +72,8 @@ set(MPV_INCLUDE_DIRS ${MPV_INCLUDE_DIR})
#
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
MPV
REQUIRED_VARS ${_MPV_REQUIRED_VARS}
VERSION_VAR MPV_VERSION_STRING
)
MPV
REQUIRED_VARS ${_MPV_REQUIRED_VARS}
VERSION_VAR MPV_VERSION_STRING
)