Update FindX files

This commit is contained in:
Filip Gawin 2021-01-14 15:22:02 +01:00
parent 85f93ef135
commit 57cc70c6af
2 changed files with 98 additions and 0 deletions

34
cmake/FindMilesSDK.cmake Normal file
View file

@ -0,0 +1,34 @@
# - Find Miles SDK
# Find the Miles SDK header + import library
#
# MilesSDK_INCLUDE_DIR - Where to find mss.h
# MilesSDK_LIBRARIES - List of libraries when using MilesSDK.
# MilesSDK_FOUND - True if Miles SDK found.
# MilesSDK::MilesSDK - Imported library of Miles SDK
find_path(MilesSDK_INCLUDE_DIR mss.h
PATHS "${MilesSDK_DIR}"
PATH_SUFFIXES include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_miles_sdk_libname mss64)
else()
set(_miles_sdk_libname mss32)
endif()
find_library(MilesSDK_LIBRARIES NAMES ${_miles_sdk_libname}
PATHS "${MilesSDK_DIR}"
PATH_SUFFIXES lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesSDK_INCLUDE_DIR)
if(NOT TARGET MilesSDK::MilesSDK)
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
set_target_properties(MilesSDK::MilesSDK PROPERTIES
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
)
endif()

64
cmake/Findopusfile.cmake Normal file
View file

@ -0,0 +1,64 @@
# - Try to find opusfile
#
# Once done this will define
#
# OPUSFILE_FOUND - system has opusfile
# OPUSFILE_INCLUDE_DIRS - the opusfile include directories
# OPUSFILE_LIBRARIES - Link these to use opusfile
# OPUSFILE_CFLAGS - Compile options to use opusfile
# opusfile::opusfile - Imported library of opusfile
#
# FIXME: opusfile does not ship an official opusfile cmake script,
# rename this file/variables/target when/if it has.
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PKG_OPUSFILE "opusfile")
endif()
find_path(OPUSFILE_INCLUDE_DIR
NAMES
opusfile.h
PATH_SUFFIXES
opusfile
HINTS
${PKG_OPUSFILE_INCLUDE_DIRS}
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(OPUSFILE_LIBRARY
NAMES
opusfile
HINTS
${PKG_OPUSFILE_LIBRARIES}
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(OPUSFILE_CFLAGS "${PKG_OPUSFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of opusfile")
set(OPUSFILE_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIR}")
set(OPUSFILE_LIBRARIES "${OPUSFILE_LIBRARY}")
if (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
set(OPUSFILE_FOUND TRUE)
endif (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(opusfile DEFAULT_MSG OPUSFILE_INCLUDE_DIRS OPUSFILE_LIBRARIES)
if(NOT TARGET opusfile::opusfile)
add_library(__opusfile INTERFACE)
target_compile_options(__opusfile INTERFACE ${OPUSFILE_CFLAGS})
target_include_directories(__opusfile INTERFACE ${OPUSFILE_INCLUDE_DIRS})
target_link_libraries(__opusfile INTERFACE ${OPUSFILE_LIBRARIES})
add_library(opusfile::opusfile ALIAS __opusfile)
endif()