From 307526c16be076708300019c6d980cc9fb803031 Mon Sep 17 00:00:00 2001 From: Thomas Lercher Date: Mon, 17 Jul 2023 18:12:35 +0200 Subject: [PATCH 1/3] Rework cmake scripts --- CMakeLists.txt | 8 ++-- cmake/Modules/FindBladeRF.cmake | 77 ++++++++++++++++++++------------- cmake/Modules/FindHackRF.cmake | 74 +++++++++++++++++++------------ cmake/Modules/FindLiquid.cmake | 36 +++++++++++---- cmake/Modules/FindUHD.cmake | 19 +++++++- 5 files changed, 144 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60277e9..e2beb8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ if(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE) include_directories(${PROJECT_SOURCE_DIR}) -include_directories(${HACKRF_INCLUDE_DIR}) -include_directories(${BLADERF_INCLUDE_DIR}) +include_directories(${LIBHACKRF_INCLUDE_DIR}) +include_directories(${LIBBLADERF_INCLUDE_DIR}) include_directories(${UHD_INCLUDE_DIR}) include_directories(${LIQUID_INCLUDE_DIR}) @@ -129,8 +129,8 @@ endif() target_link_libraries(ice9-bluetooth PRIVATE Threads::Threads m - ${HACKRF_LIBRARIES} - ${BLADERF_LIBRARIES} + ${LIBHACKRF_LIBRARIES} + ${LIBBLADERF_LIBRARIES} ${UHD_LIBRARIES} ${LIQUID_LIBRARIES} ) diff --git a/cmake/Modules/FindBladeRF.cmake b/cmake/Modules/FindBladeRF.cmake index cb0281e..b8e9f27 100644 --- a/cmake/Modules/FindBladeRF.cmake +++ b/cmake/Modules/FindBladeRF.cmake @@ -1,43 +1,62 @@ -# - 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) +FIND_LIBRARY(LIBBLADERF_LIBRARY + NAMES bladeRF + HINTS + $ENV{LIBBLADERF_DIR}/lib + ${PC_LIBBLADERF_LIBDIR} + ${PC_LIBBLADERF_LIBRARY_DIRS} +) + +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 (BLADERF_FIND_REQUIRED) -ENDIF (BLADERF_FOUND) + 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( - BLADERF_LIBRARY - BLADERF_INCLUDE_DIR -) \ No newline at end of file + LIBBLADERF_LIBRARY + LIBBLADERF_INCLUDE_DIR +) + +set(LIBBLADERF_INCLUDE_DIRS ${LIBBLADERF_INCLUDE_DIR}) +set(LIBBLADERF_LIBRARIES ${LIBBLADERF_LIBRARY}) \ No newline at end of file diff --git a/cmake/Modules/FindHackRF.cmake b/cmake/Modules/FindHackRF.cmake index b9ea7c9..3f989db 100644 --- a/cmake/Modules/FindHackRF.cmake +++ b/cmake/Modules/FindHackRF.cmake @@ -1,44 +1,64 @@ -# - 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(HACKRF_LIBRARY hackrf) +FIND_LIBRARY(LIBHACKRF_LIBRARY + NAMES hackrf + HINTS + $ENV{LIBHACKRF_DIR}/lib + ${PC_LIBHACKRF_LIBDIR} + ${PC_LIBHACKRF_LIBRARY_DIRS} +) -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) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(HackRF DEFAULT_MSG LIBHACKRF_LIBRARY LIBHACKRF_INCLUDE_DIR) -IF (HACKRF_FOUND) +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: ${HACKRF_LIBRARIES}") + MESSAGE(STATUS "Found HackRF: ${LIBHACKRF_LIBRARIES}") ENDIF (NOT HACKRF_FIND_QUIETLY) -ELSE (HACKRF_FOUND) +ELSE (LIBHACKRF_FOUND) IF (HACKRF_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find HackRF library") ENDIF (HACKRF_FIND_REQUIRED) -ENDIF (HACKRF_FOUND) +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 + LIBHACKRF_LIBRARY + LIBHACKRF_INCLUDE_DIR ) + +set(LIBHACKRF_INCLUDE_DIRS ${LIBHACKRF_INCLUDE_DIR}) +set(LIBHACKRF_LIBRARIES ${LIBHACKRF_LIBRARY}) \ No newline at end of file diff --git a/cmake/Modules/FindLiquid.cmake b/cmake/Modules/FindLiquid.cmake index 9a94bda..664daf2 100644 --- a/cmake/Modules/FindLiquid.cmake +++ b/cmake/Modules/FindLiquid.cmake @@ -7,16 +7,33 @@ # also defined, but not for general use are # LIQUID_LIBRARY, where to find the LIQUID library. -FIND_PATH(LIQUID_INCLUDE_DIR liquid.h - ${LIQUID_DIR}/include/liquid - /opt/homebrew/include/liquid - /home/linuxbrew/.linuxbrew/include/liquid - /opt/local/include/liquid - /usr/include/liquid - /usr/local/include/liquid +find_package(PkgConfig) +pkg_check_modules(PC_LIQUID QUIET liquid) + +FIND_PATH(LIQUID_INCLUDE_DIR + NAMES liquid.h + HINTS + ${LIQUID_DIR}/include + ${PC_LIQUID_INCLUDEDIR} + ${PC_LIQUID_INCLUDE_DIRS} + /opt/homebrew/include + /home/linuxbrew/.linuxbrew/include + /opt/local/include + /usr/include + /usr/local/include + PATH_SUFFIXES liquid +) + +FIND_LIBRARY(LIQUID_LIBRARY + NAMES liquid + HINTS + $ENV{LIQUID_DIR}/lib + ${PC_LIQUID_LIBDIR} + ${PC_LIQUID_LIBRARY_DIRS} ) -FIND_LIBRARY(LIQUID_LIBRARY liquid) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Liquid DEFAULT_MSG LIQUID_LIBRARY LIQUID_INCLUDE_DIR) IF (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) SET(LIQUID_LIBRARIES ${LIQUID_LIBRARY}) @@ -42,3 +59,6 @@ MARK_AS_ADVANCED( LIQUID_LIBRARY LIQUID_INCLUDE_DIR ) + +set(LIQUID_INCLUDE_DIRS ${LIQUID_INCLUDE_DIR}) +set(LIQUID_LIBRARIES ${LIQUID_LIBRARY}) \ No newline at end of file diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index 4d4773c..b68e866 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -7,15 +7,24 @@ # also defined, but not for general use are # UHD_LIBRARY, where to find the UHD library. -FIND_PATH(UHD_INCLUDE_DIR uhd/config.hpp +find_package(PkgConfig) +pkg_check_modules(PC_UHD QUIET uhd) + +FIND_PATH(UHD_INCLUDE_DIR + NAMES uhd/config.hpp + HINTS ${UHD_DIR}/include + ${PC_UHD_INCLUDEDIR} + ${PC_UHD_INCLUDE_DIRS} /opt/homebrew/include /opt/local/include /usr/include /usr/local/include ) -FIND_LIBRARY(UHD_LIBRARY uhd +FIND_LIBRARY(UHD_LIBRARY + NAMES uhd + HINTS ${UHD_DIR}/lib /opt/homebrew/lib /opt/local/lib @@ -23,6 +32,9 @@ FIND_LIBRARY(UHD_LIBRARY uhd /usr/local/lib ) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARY UHD_INCLUDE_DIR) + IF (UHD_LIBRARY AND UHD_INCLUDE_DIR) SET(UHD_LIBRARIES ${UHD_LIBRARY}) SET(UHD_FOUND "YES") @@ -47,3 +59,6 @@ MARK_AS_ADVANCED( UHD_LIBRARY UHD_INCLUDE_DIR ) + +set(UHD_INCLUDE_DIRS ${UHD_INCLUDE_DIR}) +set(UHD_LIBRARIES ${UHD_LIBRARY}) \ No newline at end of file From fb5484785ab6d681720663a69fb1d378945f9ad0 Mon Sep 17 00:00:00 2001 From: Thomas Lercher Date: Mon, 17 Jul 2023 22:51:32 +0200 Subject: [PATCH 2/3] Use lowercase for cmake functions --- cmake/Modules/FindBladeRF.cmake | 44 ++++++++++++++++----------------- cmake/Modules/FindHackRF.cmake | 40 +++++++++++++++--------------- cmake/Modules/FindLiquid.cmake | 40 +++++++++++++++--------------- cmake/Modules/FindUHD.cmake | 40 +++++++++++++++--------------- 4 files changed, 82 insertions(+), 82 deletions(-) diff --git a/cmake/Modules/FindBladeRF.cmake b/cmake/Modules/FindBladeRF.cmake index b8e9f27..23976df 100644 --- a/cmake/Modules/FindBladeRF.cmake +++ b/cmake/Modules/FindBladeRF.cmake @@ -10,7 +10,7 @@ find_package(PkgConfig) pkg_check_modules(PC_LIBHACKRF QUIET libbladeRF) -FIND_PATH(LIBBLADERF_INCLUDE_DIR +find_path(LIBBLADERF_INCLUDE_DIR NAMES libbladeRF.h HINTS ${LIBBLADERF_DIR}/include @@ -22,7 +22,7 @@ FIND_PATH(LIBBLADERF_INCLUDE_DIR /usr/local/include ) -FIND_LIBRARY(LIBBLADERF_LIBRARY +find_library(LIBBLADERF_LIBRARY NAMES bladeRF HINTS $ENV{LIBBLADERF_DIR}/lib @@ -31,29 +31,29 @@ FIND_LIBRARY(LIBBLADERF_LIBRARY ) 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) +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_LIBBLADERF_LIB_PATH ${LIBBLADERF_LIBRARY} PATH) +get_filename_component(NATIVE_LIBBLADERF_LIB_PATH ${LIBBLADERF_LIBRARY} PATH) -MARK_AS_ADVANCED( +mark_as_advanced( LIBBLADERF_LIBRARY LIBBLADERF_INCLUDE_DIR ) diff --git a/cmake/Modules/FindHackRF.cmake b/cmake/Modules/FindHackRF.cmake index 3f989db..42d4465 100644 --- a/cmake/Modules/FindHackRF.cmake +++ b/cmake/Modules/FindHackRF.cmake @@ -10,7 +10,7 @@ find_package(PkgConfig) pkg_check_modules(PC_LIBHACKRF QUIET libhackrf) -FIND_PATH(LIBHACKRF_INCLUDE_DIR +find_path(LIBHACKRF_INCLUDE_DIR NAMES hackrf.h HINTS $ENV{LIBHACKRF_DIR}/include @@ -24,7 +24,7 @@ FIND_PATH(LIBHACKRF_INCLUDE_DIR PATH_SUFFIXES libhackrf ) -FIND_LIBRARY(LIBHACKRF_LIBRARY +find_library(LIBHACKRF_LIBRARY NAMES hackrf HINTS $ENV{LIBHACKRF_DIR}/lib @@ -33,29 +33,29 @@ FIND_LIBRARY(LIBHACKRF_LIBRARY ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HackRF DEFAULT_MSG LIBHACKRF_LIBRARY LIBHACKRF_INCLUDE_DIR) +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_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) +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_LIBHACKRF_LIB_PATH ${LIBHACKRF_LIBRARY} PATH) +get_filename_component(NATIVE_LIBHACKRF_LIB_PATH ${LIBHACKRF_LIBRARY} PATH) -MARK_AS_ADVANCED( +mark_as_advanced( LIBHACKRF_LIBRARY LIBHACKRF_INCLUDE_DIR ) diff --git a/cmake/Modules/FindLiquid.cmake b/cmake/Modules/FindLiquid.cmake index 664daf2..4e88679 100644 --- a/cmake/Modules/FindLiquid.cmake +++ b/cmake/Modules/FindLiquid.cmake @@ -10,7 +10,7 @@ find_package(PkgConfig) pkg_check_modules(PC_LIQUID QUIET liquid) -FIND_PATH(LIQUID_INCLUDE_DIR +find_path(LIQUID_INCLUDE_DIR NAMES liquid.h HINTS ${LIQUID_DIR}/include @@ -24,7 +24,7 @@ FIND_PATH(LIQUID_INCLUDE_DIR PATH_SUFFIXES liquid ) -FIND_LIBRARY(LIQUID_LIBRARY +find_library(LIQUID_LIBRARY NAMES liquid HINTS $ENV{LIQUID_DIR}/lib @@ -33,29 +33,29 @@ FIND_LIBRARY(LIQUID_LIBRARY ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Liquid DEFAULT_MSG LIQUID_LIBRARY LIQUID_INCLUDE_DIR) +find_package_handle_standard_args(Liquid DEFAULT_MSG LIQUID_LIBRARY LIQUID_INCLUDE_DIR) -IF (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) - SET(LIQUID_LIBRARIES ${LIQUID_LIBRARY}) - SET(LIQUID_FOUND "YES") -ELSE (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) - SET(LIQUID_FOUND "NO") -ENDIF (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) +if (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) + set(LIQUID_LIBRARIES ${LIQUID_LIBRARY}) + set(LIQUID_FOUND "YES") +else (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) + set(LIQUID_FOUND "NO") +endif (LIQUID_LIBRARY AND LIQUID_INCLUDE_DIR) -IF (LIQUID_FOUND) - IF (NOT LIQUID_FIND_QUIETLY) - MESSAGE(STATUS "Found liquid-sdr: ${LIQUID_LIBRARIES}") - ENDIF (NOT LIQUID_FIND_QUIETLY) -ELSE (LIQUID_FOUND) - IF (LIQUID_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find liquid-sdr library") - ENDIF (LIQUID_FIND_REQUIRED) -ENDIF (LIQUID_FOUND) +if (LIQUID_FOUND) + if (NOT LIQUID_FIND_QUIETLY) + message(STATUS "Found liquid-sdr: ${LIQUID_LIBRARIES}") + endif (NOT LIQUID_FIND_QUIETLY) +else (LIQUID_FOUND) + if (LIQUID_FIND_REQUIRED) + message(FATAL_ERROR "Could not find liquid-sdr library") + endif (LIQUID_FIND_REQUIRED) +endif (LIQUID_FOUND) # Deprecated declarations. -GET_FILENAME_COMPONENT (NATIVE_LIQUID_LIB_PATH ${LIQUID_LIBRARY} PATH) +get_filename_component(NATIVE_LIQUID_LIB_PATH ${LIQUID_LIBRARY} PATH) -MARK_AS_ADVANCED( +mark_as_advanced( LIQUID_LIBRARY LIQUID_INCLUDE_DIR ) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index b68e866..4f8d020 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -10,7 +10,7 @@ find_package(PkgConfig) pkg_check_modules(PC_UHD QUIET uhd) -FIND_PATH(UHD_INCLUDE_DIR +find_path(UHD_INCLUDE_DIR NAMES uhd/config.hpp HINTS ${UHD_DIR}/include @@ -22,7 +22,7 @@ FIND_PATH(UHD_INCLUDE_DIR /usr/local/include ) -FIND_LIBRARY(UHD_LIBRARY +find_library(UHD_LIBRARY NAMES uhd HINTS ${UHD_DIR}/lib @@ -33,29 +33,29 @@ FIND_LIBRARY(UHD_LIBRARY ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARY UHD_INCLUDE_DIR) +find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARY UHD_INCLUDE_DIR) -IF (UHD_LIBRARY AND UHD_INCLUDE_DIR) - SET(UHD_LIBRARIES ${UHD_LIBRARY}) - SET(UHD_FOUND "YES") -ELSE (UHD_LIBRARY AND UHD_INCLUDE_DIR) - SET(UHD_FOUND "NO") -ENDIF (UHD_LIBRARY AND UHD_INCLUDE_DIR) +if (UHD_LIBRARY AND UHD_INCLUDE_DIR) + set(UHD_LIBRARIES ${UHD_LIBRARY}) + set(UHD_FOUND "YES") +else (UHD_LIBRARY AND UHD_INCLUDE_DIR) + set(UHD_FOUND "NO") +endif (UHD_LIBRARY AND UHD_INCLUDE_DIR) -IF (UHD_FOUND) - IF (NOT UHD_FIND_QUIETLY) - MESSAGE(STATUS "Found UHD: ${UHD_LIBRARIES}") - ENDIF (NOT UHD_FIND_QUIETLY) -ELSE (UHD_FOUND) - IF (UHD_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find UHD library") - ENDIF (UHD_FIND_REQUIRED) -ENDIF (UHD_FOUND) +if (UHD_FOUND) + if (NOT UHD_FIND_QUIETLY) + message(STATUS "Found UHD: ${UHD_LIBRARIES}") + endif (NOT UHD_FIND_QUIETLY) +else (UHD_FOUND) + if (UHD_FIND_REQUIRED) + message(FATAL_ERROR "Could not find UHD library") + endif (UHD_FIND_REQUIRED) +endif (UHD_FOUND) # Deprecated declarations. -GET_FILENAME_COMPONENT (NATIVE_UHD_LIB_PATH ${UHD_LIBRARY} PATH) +get_filename_component(NATIVE_UHD_LIB_PATH ${UHD_LIBRARY} PATH) -MARK_AS_ADVANCED( +mark_as_advanced( UHD_LIBRARY UHD_INCLUDE_DIR ) From 50965d77e7ec527433d712435bbe0dff2ecd53d1 Mon Sep 17 00:00:00 2001 From: Thomas Lercher Date: Tue, 18 Jul 2023 08:32:47 +0200 Subject: [PATCH 3/3] More consistency across CMake modules --- cmake/Modules/FindBladeRF.cmake | 4 ++++ cmake/Modules/FindHackRF.cmake | 4 ++++ cmake/Modules/FindLiquid.cmake | 4 ++++ cmake/Modules/FindUHD.cmake | 2 ++ 4 files changed, 14 insertions(+) diff --git a/cmake/Modules/FindBladeRF.cmake b/cmake/Modules/FindBladeRF.cmake index 23976df..c03786f 100644 --- a/cmake/Modules/FindBladeRF.cmake +++ b/cmake/Modules/FindBladeRF.cmake @@ -28,6 +28,10 @@ find_library(LIBBLADERF_LIBRARY $ENV{LIBBLADERF_DIR}/lib ${PC_LIBBLADERF_LIBDIR} ${PC_LIBBLADERF_LIBRARY_DIRS} + /opt/homebrew/lib + /opt/local/lib + /usr/lib + /usr/local/lib ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindHackRF.cmake b/cmake/Modules/FindHackRF.cmake index 42d4465..f1671bf 100644 --- a/cmake/Modules/FindHackRF.cmake +++ b/cmake/Modules/FindHackRF.cmake @@ -30,6 +30,10 @@ find_library(LIBHACKRF_LIBRARY $ENV{LIBHACKRF_DIR}/lib ${PC_LIBHACKRF_LIBDIR} ${PC_LIBHACKRF_LIBRARY_DIRS} + /opt/homebrew/lib + /opt/local/lib + /usr/lib + /usr/local/lib ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindLiquid.cmake b/cmake/Modules/FindLiquid.cmake index 4e88679..68b54dd 100644 --- a/cmake/Modules/FindLiquid.cmake +++ b/cmake/Modules/FindLiquid.cmake @@ -30,6 +30,10 @@ find_library(LIQUID_LIBRARY $ENV{LIQUID_DIR}/lib ${PC_LIQUID_LIBDIR} ${PC_LIQUID_LIBRARY_DIRS} + /opt/homebrew/lib + /opt/local/lib + /usr/lib + /usr/local/lib ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index 4f8d020..55e8e4e 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -26,6 +26,8 @@ find_library(UHD_LIBRARY NAMES uhd HINTS ${UHD_DIR}/lib + ${PC_UHD_LIBDIR} + ${PC_UHD_LIBRARY_DIRS} /opt/homebrew/lib /opt/local/lib /usr/lib