From 0f14713dbc4e68f5b87e0cac99c44db97d58f666 Mon Sep 17 00:00:00 2001 From: Baruch Sterin Date: Thu, 5 Nov 2015 01:23:35 -0800 Subject: CMakeLists.txt, Makefile: pass readline flags from the CMake lists file to the Makefile. --- CMakeLists.txt | 9 +++++++++ Makefile | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40f2bbb7..d57dd032 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,10 +25,19 @@ endfunction() project(abc) +if(READLINE_FOUND MATCHES TRUE) + addprefix(READLINE_INCLUDES_FLAGS "-I" ${READLINE_INCLUDES}) + list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_INCLUDES=${READLINE_INCLUDES_FLAGS}") + list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_LIBRARIES=${READLINE_LIBRARIES}") +elseif(READLINE_FOUND MATCHES FALSE) + list(APPEND ABC_READLINE_FLAGS "ABC_USE_NO_READLINE=1") +endif() + # run make to extract compiler options, linker options and list of source files execute_process( COMMAND make + ${ABC_READLINE_FLAGS} ABC_MAKE_NO_DEPS=1 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} diff --git a/Makefile b/Makefile index 769b3499..e964bcdb 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,16 @@ ifndef ABC_USE_NO_CUDD $(info $(MSG_PREFIX)Compiling with CUDD) endif +ABC_READLINE_INCLUDES ?= +ABC_READLINE_LIBRARIES ?= -lreadline + +# whether to use libreadline +ifndef ABC_USE_NO_READLINE + CFLAGS += -DABC_USE_READLINE $(ABC_READLINE_INCLUDES) + LIBS += $(ABC_READLINE_LIBRARIES) + $(info $(MSG_PREFIX)Using libreadline) +endif + # whether to use libreadline ifndef ABC_USE_NO_READLINE CFLAGS += -DABC_USE_READLINE -- cgit v1.2.3