-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbladeRF: added cmake find_package() support
Fixes #418
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
if(DEFINED INCLUDED_LIBBLADERF_CONFIG_CMAKE) | ||
return() | ||
endif() | ||
|
||
set(INCLUDED_LIBBLADERF_CONFIG_CMAKE TRUE) | ||
|
||
# ####################################################################### | ||
# libbladeRFConfig - cmake project configuration | ||
# | ||
# The following will be set after find_package(libbladeRF CONFIG): | ||
# libbladeRF_LIBRARIES - development libraries | ||
# libbladeRF_INCLUDE_DIRS - development includes | ||
# ####################################################################### | ||
|
||
# ####################################################################### | ||
# # installation root | ||
# ####################################################################### | ||
if(UNIX) | ||
get_filename_component(LIBBLADERF_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) | ||
elseif(WIN32) | ||
get_filename_component(LIBBLADERF_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) | ||
endif() | ||
|
||
# ####################################################################### | ||
# # locate the library | ||
# ####################################################################### | ||
find_library( | ||
LIBBLADERF_LIBRARY bladeRF | ||
PATHS ${LIBBLADERF_ROOT}/lib${LIB_SUFFIX} | ||
PATH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE} | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
if(NOT LIBBLADERF_LIBRARY) | ||
message(FATAL_ERROR "cannot find libbladeRF library in ${LIBBLADERF_ROOT}/lib${LIB_SUFFIX}") | ||
endif() | ||
|
||
set(libbladeRF_LIBRARIES ${LIBBLADERF_LIBRARY}) | ||
|
||
# ####################################################################### | ||
# # locate the includes | ||
# ####################################################################### | ||
find_path( | ||
LIBBLADERF_INCLUDE_DIR libbladeRF.h | ||
PATHS ${LIBBLADERF_ROOT}/include | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
if(NOT LIBBLADERF_INCLUDE_DIR) | ||
message(FATAL_ERROR "cannot find libbladeRF includes in ${LIBBLADERF_ROOT}/include/libbladeRF") | ||
endif() | ||
|
||
set(libbladeRF_INCLUDE_DIRS ${LIBBLADERF_INCLUDE_DIR}) |
11 changes: 11 additions & 0 deletions
11
host/libraries/libbladeRF/cmake/libbladeRFConfigVersion.cmake.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
set(PACKAGE_VERSION "@LIBBLADERF_VERSION@") | ||
|
||
# Check whether the requested PACKAGE_FIND_VERSION is compatible | ||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") | ||
set(PACKAGE_VERSION_COMPATIBLE FALSE) | ||
else() | ||
set(PACKAGE_VERSION_COMPATIBLE TRUE) | ||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") | ||
set(PACKAGE_VERSION_EXACT TRUE) | ||
endif() | ||
endif() |