1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-26 12:04:13 -04:00
Files
sdrangel/cmake/Modules/FindCodec2.cmake
T

56 lines
1.9 KiB
CMake
Raw Normal View History

# If CODEC2_DIR is specified, treat it as an explicit user override and
# search that installation directly. Otherwise use pkg-config to verify
# the minimum supported codec2 version before locating the headers and
# library.
2020-04-30 15:19:19 +03:00
if (NOT CODEC2_FOUND)
if (CODEC2_DIR)
message(STATUS "Using CODEC2_DIR: ${CODEC2_DIR}")
else()
find_package(PkgConfig QUIET)
if(NOT PKG_CONFIG_FOUND)
message(STATUS "codec2 support disabled: pkg-config is required to verify codec2 version.")
return()
endif()
pkg_check_modules(PC_CODEC2 QUIET codec2>=1.1.1)
if(NOT PC_CODEC2_FOUND)
message(STATUS "codec2 support disabled: codec2 >= 1.1.1 was not found.")
return()
endif()
endif()
2020-04-30 15:19:19 +03:00
FIND_PATH(CODEC2_INCLUDE_DIR
NAMES codec2/codec2.h
HINTS ${CODEC2_DIR}/include
${PC_CODEC2_INCLUDE_DIRS}
2020-04-30 15:19:19 +03:00
${CMAKE_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
)
2020-04-30 15:19:19 +03:00
FIND_LIBRARY(CODEC2_LIBRARIES
NAMES codec2 libcodec2
HINTS ${CODEC2_DIR}/lib
${CODEC2_DIR}/lib64
${PC_CODEC2_LIBRARY_DIRS}
2020-04-30 15:19:19 +03:00
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
2020-04-30 15:19:19 +03:00
if(CODEC2_INCLUDE_DIR AND CODEC2_LIBRARIES)
set(CODEC2_FOUND TRUE CACHE INTERNAL "CODEC2 found")
message(STATUS "Found Codec2: ${CODEC2_INCLUDE_DIR}, ${CODEC2_LIBRARIES}")
else()
set(CODEC2_FOUND FALSE CACHE INTERNAL "CODEC2 found")
message(STATUS "Codec2 not found")
endif()
2020-04-30 15:19:19 +03:00
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CODEC2 DEFAULT_MSG CODEC2_LIBRARIES CODEC2_INCLUDE_DIR)
MARK_AS_ADVANCED(CODEC2_LIBRARIES CODEC2_INCLUDE_DIR)
endif (NOT CODEC2_FOUND)