From e1f4dcd3de9172cbf6d433b7851fbda4bc6c8e7c Mon Sep 17 00:00:00 2001 From: Jon Szymaniak Date: Sat, 31 Aug 2013 21:14:06 -0400 Subject: [PATCH] bladeRF-cli: ENABLE_INTERACTIVE_TECLA set to OFF if libtecla is not found --- host/cmake/modules/FindLibTecla.cmake | 7 +++++++ host/utilities/bladeRF-cli/CMakeLists.txt | 19 +++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/host/cmake/modules/FindLibTecla.cmake b/host/cmake/modules/FindLibTecla.cmake index e6183285..d3bcedd8 100644 --- a/host/cmake/modules/FindLibTecla.cmake +++ b/host/cmake/modules/FindLibTecla.cmake @@ -6,6 +6,13 @@ # # License: GPLv3 # +if(DEFINED __INCLUDED_BLADERF_FINDLIBTECLA_CMAKE) + return() +endif() +set(__INCLUDED_BLADERF_FINDLIBTECLA_CMAKE TRUE) + +find_package(PkgConfig) + if(NOT LIBTECLA_FOUND) pkg_check_modules (LIBTECLA_PKG libtecla) find_path(LIBTECLA_INCLUDE_DIR NAMES libtecla.h diff --git a/host/utilities/bladeRF-cli/CMakeLists.txt b/host/utilities/bladeRF-cli/CMakeLists.txt index 582c847a..e9a02760 100644 --- a/host/utilities/bladeRF-cli/CMakeLists.txt +++ b/host/utilities/bladeRF-cli/CMakeLists.txt @@ -28,11 +28,18 @@ configure_file( # Configuration options ################################################################################ +find_package(LibTecla) option(ENABLE_INTERACTIVE_TECLA "Enable interactive mode support via libtecla" ON ) +if(ENABLE_INTERACTIVE_TECLA AND NOT ${LIBTECLA_FOUND}) + message(STATUS "Disabling ENABLE_INTERACTIVE_TECLA because libtecla was not found.") + set(ENABLE_INTERACTIVE_TECLA OFF) +endif() + + ################################################################################ # Include paths ################################################################################ @@ -72,7 +79,7 @@ set(BLADERF_CLI_SOURCE if(ENABLE_INTERACTIVE_TECLA) add_definitions(-DINTERACTIVE=y) - set (BLADERF_CLI_SOURCE ${BLADERF_CLI_SOURCE} src/interactive/interactive.c) + set(BLADERF_CLI_SOURCE ${BLADERF_CLI_SOURCE} src/interactive/interactive.c) endif() add_executable(bladeRF-cli ${BLADERF_CLI_SOURCE}) @@ -80,23 +87,15 @@ add_executable(bladeRF-cli ${BLADERF_CLI_SOURCE}) ################################################################################ # Build dependencies ################################################################################ -find_package(PkgConfig) find_package(Threads) set(CLI_LINK_LIBRARIES libbladerf_shared ${CMAKE_THREAD_LIBS_INIT} -) +) if(ENABLE_INTERACTIVE_TECLA) - find_package(LibTecla) - if(NOT LIBTECLA_FOUND) - message(FATAL_ERROR - "ENABLE_INTERACTIVE_TECLA set, but libtecla could not be found") - endif(NOT LIBTECLA_FOUND) - set(CLI_LINK_LIBRARIES ${CLI_LINK_LIBRARIES} ${LIBTECLA_LIBRARIES} ncurses) - endif(ENABLE_INTERACTIVE_TECLA) ################################################################################