From ef4fbc98d976655af70fc18f5786e620b1165376 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 31 Jul 2024 21:00:51 +0200 Subject: [PATCH] Avoid code duplication in CMake modules --- CMakeLists.txt | 1 + cmake/Modules/FindCPUFEATURES.cmake | 35 +++------------- cmake/Modules/FindGFLAGS.cmake | 35 +++------------- cmake/Modules/FindGFORTRAN.cmake | 33 ++++----------- cmake/Modules/FindGLOG.cmake | 35 +++------------- cmake/Modules/FindGNURADIO.cmake | 65 +++-------------------------- cmake/Modules/FindGRIIO.cmake | 35 +++------------- cmake/Modules/FindGRLIMESDR.cmake | 35 +++------------- cmake/Modules/FindGROSMOSDR.cmake | 35 +++------------- cmake/Modules/FindLIBAD9361.cmake | 35 +++------------- cmake/Modules/FindLIBIIO.cmake | 35 +++------------- cmake/Modules/FindLIBUNWIND.cmake | 5 +++ cmake/Modules/FindLOG4CPP.cmake | 34 +++------------ cmake/Modules/FindMATIO.cmake | 32 +++----------- cmake/Modules/FindORC.cmake | 46 +++----------------- cmake/Modules/FindPCAP.cmake | 32 +++----------- cmake/Modules/FindPUGIXML.cmake | 33 +++------------ cmake/Modules/FindUHD.cmake | 35 +++------------- cmake/Modules/FindVOLK.cmake | 34 +++------------ cmake/Modules/FindZEROMQ.cmake | 32 +++----------- cmake/Modules/GnsssdrLibPaths.cmake | 43 +++++++++++++++++++ 21 files changed, 143 insertions(+), 562 deletions(-) create mode 100644 cmake/Modules/GnsssdrLibPaths.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a60741b..620fd5957 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH ${GNSSSDR_SOURCE_DIR}/cmake/Modules) # Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..' ################################################################################ include(FeatureSummary) +include(GnsssdrLibPaths) # Support of optional RF front-ends option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON) diff --git a/cmake/Modules/FindCPUFEATURES.cmake b/cmake/Modules/FindCPUFEATURES.cmake index 7c25e69c2..6f4f0e58f 100644 --- a/cmake/Modules/FindCPUFEATURES.cmake +++ b/cmake/Modules/FindCPUFEATURES.cmake @@ -6,38 +6,13 @@ set(FPHSA_NAME_MISMATCHED ON) +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_library(CPUFEATURES_LIBRARIES NAMES cpu_features - PATHS /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) find_path(CPUFEATURES_INCLUDE_DIR cpu_features_macros.h diff --git a/cmake/Modules/FindGFLAGS.cmake b/cmake/Modules/FindGFLAGS.cmake index 08a5056b8..cbfa07cd3 100644 --- a/cmake/Modules/FindGFLAGS.cmake +++ b/cmake/Modules/FindGFLAGS.cmake @@ -25,6 +25,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFLAGS_ROOT) set(GFLAGS_ROOT_USER_PROVIDED /usr/local) else() @@ -52,36 +56,7 @@ else() PATHS ${GFLAGS_ROOT_USER_PROVIDED}/lib ${GFLAGS_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index 5a698ce89..26764a688 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -8,6 +8,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFORTRAN_ROOT) set(GFORTRAN_ROOT_USER_DEFINED /usr/lib) else() @@ -20,13 +24,12 @@ if(DEFINED ENV{GFORTRAN_ROOT}) ) endif() -set(GCC_MAJOR_SERIES 14 13 12 11 10 9 8 7 6 5) +set(GCC_MAJOR_SERIES 15 14 13 12 11 10 9 8 7 6 5) set(GCC4_SERIES 4.9.1 4.9 4.8.3 4.8.1 4.7.2 4.7 4.8.2 4.8 4.7 4.6 4.5 4.4.4 4.4) set(GCC_SERIES ${GCC_MAJOR_SERIES} ${GCC4_SERIES}) find_library(GFORTRAN NAMES gfortran PATHS ${GFORTRAN_ROOT_USER_DEFINED} - /usr/lib64 /usr/lib/gcc/x86_64-linux-gnu # Debian /usr/lib/gcc/i386-linux-gnu /usr/lib/gcc/i486-linux-gnu @@ -65,35 +68,13 @@ find_library(GFORTRAN NAMES gfortran /usr/lib/gcc/x86_64-suse-linux /usr/lib/gcc/armv6hl-suse-linux-gnueabi /usr/lib/gcc/armv7hl-suse-linux-gnueabi + /usr/lib/gcc/loongarch64-linux-gnu /usr/lib64/gcc/aarch64-suse-linux /usr/lib64/gcc/powerpc64-suse-linux /usr/lib64/gcc/powerpc64le-suse-linux /usr/lib64/gcc/riscv64-suse-linux /usr/lib64/gcc/s390x-suse-linux - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/aarch64-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /usr/local/lib/i386 + ${GNSSSDR_LIB_PATHS} PATH_SUFFIXES ${GCC_SERIES} ) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 6c506643e..8f6c880a0 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -24,6 +24,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -45,36 +49,7 @@ macro(_FIND_GLOG_LIBRARIES _var) NAMES ${ARGN} HINTS ${PC_GLOG_LIBDIR} PATHS ${LIB_PATHS} - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${GLOG_ROOT}/lib $ENV{GLOG_ROOT}/lib ${GLOG_ROOT}/lib64 diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 9855ddc29..cfaf51764 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -12,6 +12,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -105,36 +109,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) HINTS ${PC_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}}) endforeach() @@ -314,35 +289,7 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) HINTS ${PC_GNURADIO_IIO_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(GNURADIO_IIO_LIBRARIES) diff --git a/cmake/Modules/FindGRIIO.cmake b/cmake/Modules/FindGRIIO.cmake index 1abd5caf4..6a4352fc0 100644 --- a/cmake/Modules/FindGRIIO.cmake +++ b/cmake/Modules/FindGRIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(IIO_LIBRARIES HINTS ${PC_IIO_LIBDIR} PATHS ${GRIIO_ROOT_USER_DEFINED}/lib ${GRIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGRLIMESDR.cmake b/cmake/Modules/FindGRLIMESDR.cmake index 2fb60cb3f..a0ca9a565 100644 --- a/cmake/Modules/FindGRLIMESDR.cmake +++ b/cmake/Modules/FindGRLIMESDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GRLIMESDR_LIBRARIES PATHS ${GRLIMESDR_ROOT_USER_DEFINED}/lib ${GRLIMESDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake index 22ee7d51e..15a36c32b 100644 --- a/cmake/Modules/FindGROSMOSDR.cmake +++ b/cmake/Modules/FindGROSMOSDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GROSMOSDR_LIBRARIES PATHS ${GROSMOSDR_ROOT_USER_DEFINED}/lib ${GROSMOSDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindLIBAD9361.cmake b/cmake/Modules/FindLIBAD9361.cmake index e1ff8e4a3..175a81af2 100644 --- a/cmake/Modules/FindLIBAD9361.cmake +++ b/cmake/Modules/FindLIBAD9361.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -49,36 +53,7 @@ find_library(LIBAD9361_LIBRARIES HINTS ${PC_LIBAD9361_LIBDIR} PATHS ${LIBAD9361_ROOT_USER_DEFINED}/lib ${LIBAD9361_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/ad9361.framework ) diff --git a/cmake/Modules/FindLIBIIO.cmake b/cmake/Modules/FindLIBIIO.cmake index 44f4d367e..add9215de 100644 --- a/cmake/Modules/FindLIBIIO.cmake +++ b/cmake/Modules/FindLIBIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -51,36 +55,7 @@ find_library( HINTS ${PC_LIBIIO_LIBDIR} PATHS ${LIBIIO_ROOT_USER_DEFINED}/lib ${LIBIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/iio.framework/ ) diff --git a/cmake/Modules/FindLIBUNWIND.cmake b/cmake/Modules/FindLIBUNWIND.cmake index f2c88b569..b5c6a68a8 100644 --- a/cmake/Modules/FindLIBUNWIND.cmake +++ b/cmake/Modules/FindLIBUNWIND.cmake @@ -17,6 +17,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h @@ -41,6 +45,7 @@ find_library(LIBUNWIND_GENERIC_LIBRARY PATHS "${LIBUNWIND_ROOT}/lib" "${LIBUNWIND_ROOT}/lib64" + ${GNSSSDR_LIB_PATHS} ) if(LIBUNWIND_INCLUDE_DIR) diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 95a14cf62..f351ebf3a 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -19,6 +19,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -74,35 +78,7 @@ find_library(LOG4CPP_LIBRARY HINTS ${PC_LOG4CPP_LIBDIR} PATHS ${LOG4CPP_ROOT_USER_PROVIDED}/lib ${LOG4CPP_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY) diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index d9a6cebd2..73f8d053d 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -55,6 +55,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT MATIO_ROOT) set(MATIO_ROOT_USER_DEFINED /usr) else() @@ -85,33 +89,7 @@ find_library(MATIO_LIBRARY PATHS ${MATIO_ROOT_USER_DEFINED}/lib ${MATIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib DOC "The MATIO library" ) diff --git a/cmake/Modules/FindORC.cmake b/cmake/Modules/FindORC.cmake index b6a4ba364..600d0ac35 100644 --- a/cmake/Modules/FindORC.cmake +++ b/cmake/Modules/FindORC.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -65,26 +69,7 @@ find_path(ORC_LIBRARY_DIR ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIB orc-0.4 @@ -93,26 +78,7 @@ find_library(ORC_LIB orc-0.4 ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index 39a7aff15..2a3db3aff 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -23,6 +23,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -88,33 +92,7 @@ else() ${PC_PCAP_LIBDIR} PATHS ${PCAP_ROOT_USER_PROVIDED}/lib - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindPUGIXML.cmake b/cmake/Modules/FindPUGIXML.cmake index 5f7f5dcb2..4ff6419cc 100644 --- a/cmake/Modules/FindPUGIXML.cmake +++ b/cmake/Modules/FindPUGIXML.cmake @@ -20,6 +20,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -66,36 +70,9 @@ find_library(PUGIXML_LIBRARY ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-${PC_PUGIXML_VERSION} ${PUGIXML_ROOT_USER_DEFINED}}/lib/pugixml-1.9 ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-1.9 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/i386-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 + ${GNSSSDR_LIB_PATHS} /usr/local/lib/pugixml-${PC_PUGIXML_VERSION} /usr/local/lib/pugixml-1.9 - /opt/local/lib ) # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index a6ed654a3..d30313535 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -60,36 +64,7 @@ find_library(UHD_LIBRARIES HINTS ${PC_UHD_LIBDIR} PATHS ${UHD_ROOT_USER_PROVIDED}/lib ${UHD_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindVOLK.cmake b/cmake/Modules/FindVOLK.cmake index bda662186..2247f8247 100644 --- a/cmake/Modules/FindVOLK.cmake +++ b/cmake/Modules/FindVOLK.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -58,35 +62,7 @@ find_library(VOLK_LIBRARIES HINTS ${PC_VOLK_LIBDIR} PATHS ${VOLK_ROOT_USER_PROVIDED}/lib ${VOLK_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake index 6579d9ed7..d42a68d2d 100644 --- a/cmake/Modules/FindZEROMQ.cmake +++ b/cmake/Modules/FindZEROMQ.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -29,33 +33,7 @@ find_path(ZEROMQ_INCLUDE_DIRS find_library(ZEROMQ_LIBRARIES NAMES zmq libzmq.so.5 ${ZEROMQ_LIBRARY_NAME} HINTS ${PC_ZEROMQ_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - PATHS /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/GnsssdrLibPaths.cmake b/cmake/Modules/GnsssdrLibPaths.cmake new file mode 100644 index 000000000..9f76e362f --- /dev/null +++ b/cmake/Modules/GnsssdrLibPaths.cmake @@ -0,0 +1,43 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(GNSSSDR_LIB_PATHS) + return() +endif() + +set(GNSSSDR_LIB_PATHS + /usr/lib + /usr/lib/aarch64-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/i386-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib64 + /usr/local/lib + /usr/local/lib/i386 + /usr/local/lib64 + /opt/local/lib +)