mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-13 23:13:49 -04:00
cmake: verify minimum libcm256cc version via pkg-config
libcm256cc does not expose its package version through its headers or shared library, making it impossible to verify a minimum supported version after discovery leading to errors when building. When CM256CC_DIR is not specified, use pkg-config to verify that libcm256cc >= 1.1.2 is available before searching for the headers and library. If the required version is not found, disable CM256 support and continue configuring the rest of the project. When CM256CC_DIR is provided, treat it as an explicit user override and search that installation directly and blindly (don't check version). Also update the pkg-config hint variables to use the documented *_INCLUDE_DIRS and *_LIBRARY_DIRS outputs from pkg_check_modules(). https://cmake.org/cmake/help/latest/module/FindPkgConfig.html Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
# If CM256CC_DIR is specified, treat it as an explicit user override and
|
||||
# search that installation directly. Otherwise, use pkg-config to verify
|
||||
# the minimum supported libcm256cc version, since the library itself does
|
||||
# not expose version information through its headers or shared library.
|
||||
|
||||
if (NOT CM256CC_FOUND)
|
||||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(PC_CM256cc "libcm256cc")
|
||||
if(CM256CC_DIR)
|
||||
message(STATUS "Using CM256CC_DIR: ${CM256CC_DIR}")
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(NOT PKG_CONFIG_FOUND)
|
||||
message(STATUS "CM256CC support disabled: pkg-config is required to verify libcm256cc.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
pkg_check_modules(PC_CM256CC QUIET libcm256cc>=1.1.2)
|
||||
if(NOT PC_CM256CC_FOUND)
|
||||
message(STATUS "CM256CC support disabled: libcm256cc >= 1.1.2 was not found.")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FIND_PATH(CM256CC_INCLUDE_DIR
|
||||
NAMES cm256cc/cm256.h
|
||||
HINTS ${CM256CC_DIR}/include
|
||||
${PC_CM256CC_INCLUDE_DIR}
|
||||
${PC_CM256CC_INCLUDE_DIRS}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
@@ -15,7 +33,7 @@ if (NOT CM256CC_FOUND)
|
||||
NAMES cm256cc libcm256cc
|
||||
HINTS ${CM256CC_DIR}/lib
|
||||
${CM256CC_DIR}/lib64
|
||||
${PC_CM256CC_LIBDIR}
|
||||
${PC_CM256CC_LIBRARY_DIRS}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
PATHS /usr/local/lib
|
||||
|
||||
Reference in New Issue
Block a user