-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from tlercher/rework_cmake_search
Rework CMake modules
- Loading branch information
Showing
5 changed files
with
205 additions
and
117 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 |
---|---|---|
@@ -1,43 +1,66 @@ | ||
# - Find BLADERF | ||
# Find the native BLADERF includes and library | ||
# - Find LIBBLADERF | ||
# Find the native LIBBLADERF includes and library | ||
# This module defines | ||
# BLADERF_INCLUDE_DIR, where to find bladerf.h, etc. | ||
# BLADERF_LIBRARIES, the libraries needed to use BLADERF. | ||
# BLADERF_FOUND, If false, do not try to use BLADERF. | ||
# LIBBLADERF_INCLUDE_DIR, where to find bladerf.h, etc. | ||
# LIBBLADERF_LIBRARIES, the libraries needed to use LIBBLADERF. | ||
# LIBBLADERF_FOUND, If false, do not try to use LIBBLADERF. | ||
# also defined, but not for general use are | ||
# BLADERF_LIBRARY, where to find the BLADERF library. | ||
# LIBBLADERF_LIBRARY, where to find LIBBLADERF. | ||
|
||
FIND_PATH(BLADERF_INCLUDE_DIR libbladeRF.h | ||
${BLADERF_DIR}/include | ||
find_package(PkgConfig) | ||
pkg_check_modules(PC_LIBHACKRF QUIET libbladeRF) | ||
|
||
find_path(LIBBLADERF_INCLUDE_DIR | ||
NAMES libbladeRF.h | ||
HINTS | ||
${LIBBLADERF_DIR}/include | ||
${PC_LIBBLADERF_INCLUDEDIR} | ||
${PC_LIBBLADERF_INCLUDE_DIRS} | ||
/opt/homebrew/include | ||
/opt/local/include | ||
/usr/include | ||
/usr/local/include | ||
) | ||
|
||
FIND_LIBRARY(BLADERF_LIBRARY bladeRF) | ||
|
||
IF (BLADERF_LIBRARY AND BLADERF_INCLUDE_DIR) | ||
SET(BLADERF_LIBRARIES ${BLADERF_LIBRARY}) | ||
SET(BLADERF_FOUND "YES") | ||
ELSE (BLADERF_LIBRARY AND BLADERF_INCLUDE_DIR) | ||
SET(BLADERF_FOUND "NO") | ||
ENDIF (BLADERF_LIBRARY AND BLADERF_INCLUDE_DIR) | ||
|
||
IF (BLADERF_FOUND) | ||
IF (NOT BLADERF_FIND_QUIETLY) | ||
MESSAGE(STATUS "Found bladeRF: ${BLADERF_LIBRARIES}") | ||
ENDIF (NOT BLADERF_FIND_QUIETLY) | ||
ELSE (BLADERF_FOUND) | ||
IF (BLADERF_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find bladeRF library") | ||
ENDIF (BLADERF_FIND_REQUIRED) | ||
ENDIF (BLADERF_FOUND) | ||
find_library(LIBBLADERF_LIBRARY | ||
NAMES bladeRF | ||
HINTS | ||
$ENV{LIBBLADERF_DIR}/lib | ||
${PC_LIBBLADERF_LIBDIR} | ||
${PC_LIBBLADERF_LIBRARY_DIRS} | ||
/opt/homebrew/lib | ||
/opt/local/lib | ||
/usr/lib | ||
/usr/local/lib | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(BladeRF DEFAULT_MSG LIBBLADERF_LIBRARY LIBBLADERF_INCLUDE_DIR) | ||
|
||
if (LIBBLADERF_LIBRARY AND LIBBLADERF_INCLUDE_DIR) | ||
set(LIBBLADERF_LIBRARIES ${LIBBLADERF_LIBRARY}) | ||
set(LIBBLADERF_FOUND "YES") | ||
else (LIBBLADERF_LIBRARY AND LIBBLADERF_INCLUDE_DIR) | ||
set(LIBBLADERF_FOUND "NO") | ||
endif (LIBBLADERF_LIBRARY AND LIBBLADERF_INCLUDE_DIR) | ||
|
||
if (LIBBLADERF_FOUND) | ||
if (NOT LIBBLADERF_FIND_QUIETLY) | ||
message(STATUS "Found bladeRF: ${LIBBLADERF_LIBRARIES}") | ||
endif (NOT LIBBLADERF_FIND_QUIETLY) | ||
else (LIBBLADERF_FOUND) | ||
if (LIBBLADERF_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find bladeRF library") | ||
endif (LIBBLADERF_FIND_REQUIRED) | ||
endif (LIBBLADERF_FOUND) | ||
|
||
# Deprecated declarations. | ||
GET_FILENAME_COMPONENT (NATIVE_BLADERF_LIB_PATH ${BLADERF_LIBRARY} PATH) | ||
get_filename_component(NATIVE_LIBBLADERF_LIB_PATH ${LIBBLADERF_LIBRARY} PATH) | ||
|
||
mark_as_advanced( | ||
LIBBLADERF_LIBRARY | ||
LIBBLADERF_INCLUDE_DIR | ||
) | ||
|
||
MARK_AS_ADVANCED( | ||
BLADERF_LIBRARY | ||
BLADERF_INCLUDE_DIR | ||
) | ||
set(LIBBLADERF_INCLUDE_DIRS ${LIBBLADERF_INCLUDE_DIR}) | ||
set(LIBBLADERF_LIBRARIES ${LIBBLADERF_LIBRARY}) |
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 |
---|---|---|
@@ -1,44 +1,68 @@ | ||
# - Find HACKRF | ||
# - Find LIBHACKRF | ||
# Find the native HACKRF includes and library | ||
# This module defines | ||
# HACKRF_INCLUDE_DIR, where to find hackrf.h, etc. | ||
# HACKRF_LIBRARIES, the libraries needed to use HACKRF. | ||
# HACKRF_FOUND, If false, do not try to use HACKRF. | ||
# LIBHACKRF_INCLUDE_DIR, where to find hackrf.h, etc. | ||
# LIBHACKRF_LIBRARIES, the libraries needed to use HACKRF. | ||
# LIBHACKRF_FOUND, If false, do not try to use HACKRF. | ||
# also defined, but not for general use are | ||
# HACKRF_LIBRARY, where to find the HACKRF library. | ||
|
||
FIND_PATH(HACKRF_INCLUDE_DIR hackrf.h | ||
${HACKRF_DIR}/include/libhackrf | ||
/opt/homebrew/include/libhackrf | ||
/opt/local/include/libhackrf | ||
/home/linuxbrew/.linuxbrew/include/libhackrf | ||
/usr/include/libhackrf | ||
/usr/local/include/libhackrf | ||
# LIBHACKRF_LIBRARY, where to find the HACKRF library. | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PC_LIBHACKRF QUIET libhackrf) | ||
|
||
find_path(LIBHACKRF_INCLUDE_DIR | ||
NAMES hackrf.h | ||
HINTS | ||
$ENV{LIBHACKRF_DIR}/include | ||
${PC_LIBHACKRF_INCLUDEDIR} | ||
${PC_LIBHACKRF_INCLUDE_DIRS} | ||
/opt/homebrew/include | ||
/opt/local/include | ||
/home/linuxbrew/.linuxbrew/include | ||
/usr/include | ||
/usr/local/include | ||
PATH_SUFFIXES libhackrf | ||
) | ||
|
||
find_library(LIBHACKRF_LIBRARY | ||
NAMES hackrf | ||
HINTS | ||
$ENV{LIBHACKRF_DIR}/lib | ||
${PC_LIBHACKRF_LIBDIR} | ||
${PC_LIBHACKRF_LIBRARY_DIRS} | ||
/opt/homebrew/lib | ||
/opt/local/lib | ||
/usr/lib | ||
/usr/local/lib | ||
) | ||
|
||
FIND_LIBRARY(HACKRF_LIBRARY hackrf) | ||
|
||
IF (HACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
SET(HACKRF_LIBRARIES ${HACKRF_LIBRARY}) | ||
SET(HACKRF_FOUND "YES") | ||
ELSE (HACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
SET(HACKRF_FOUND "NO") | ||
ENDIF (HACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
|
||
IF (HACKRF_FOUND) | ||
IF (NOT HACKRF_FIND_QUIETLY) | ||
MESSAGE(STATUS "Found HackRF: ${HACKRF_LIBRARIES}") | ||
ENDIF (NOT HACKRF_FIND_QUIETLY) | ||
ELSE (HACKRF_FOUND) | ||
IF (HACKRF_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find HackRF library") | ||
ENDIF (HACKRF_FIND_REQUIRED) | ||
ENDIF (HACKRF_FOUND) | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(HackRF DEFAULT_MSG LIBHACKRF_LIBRARY LIBHACKRF_INCLUDE_DIR) | ||
|
||
if(LIBHACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
set(LIBHACKRF_LIBRARIES ${LIBHACKRF_LIBRARY}) | ||
set(LIBHACKRF_FOUND "YES") | ||
else (LIBHACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
set(LIBHACKRF_FOUND "NO") | ||
endif(LIBHACKRF_LIBRARY AND HACKRF_INCLUDE_DIR) | ||
|
||
if(LIBHACKRF_FOUND) | ||
if(NOT HACKRF_FIND_QUIETLY) | ||
message(STATUS "Found HackRF: ${LIBHACKRF_LIBRARIES}") | ||
endif(NOT HACKRF_FIND_QUIETLY) | ||
else (LIBHACKRF_FOUND) | ||
if(HACKRF_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find HackRF library") | ||
endif(HACKRF_FIND_REQUIRED) | ||
endif(LIBHACKRF_FOUND) | ||
|
||
# Deprecated declarations. | ||
GET_FILENAME_COMPONENT (NATIVE_HACKRF_LIB_PATH ${HACKRF_LIBRARY} PATH) | ||
get_filename_component(NATIVE_LIBHACKRF_LIB_PATH ${LIBHACKRF_LIBRARY} PATH) | ||
|
||
MARK_AS_ADVANCED( | ||
HACKRF_LIBRARY | ||
HACKRF_INCLUDE_DIR | ||
mark_as_advanced( | ||
LIBHACKRF_LIBRARY | ||
LIBHACKRF_INCLUDE_DIR | ||
) | ||
|
||
set(LIBHACKRF_INCLUDE_DIRS ${LIBHACKRF_INCLUDE_DIR}) | ||
set(LIBHACKRF_LIBRARIES ${LIBHACKRF_LIBRARY}) |
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