Commit b18eb603 by Baruch Sterin

CMakeLists.txt, Makefile: fix a bug in passing the readline options

parent e50fc467
...@@ -4,6 +4,13 @@ include(CMakeParseArguments) ...@@ -4,6 +4,13 @@ include(CMakeParseArguments)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
function(addprefix var prefix)
foreach( s ${ARGN} )
list(APPEND tmp "-I${s}")
endforeach()
set(${var} ${tmp} PARENT_SCOPE)
endfunction()
# filter out flags that are not appropriate for the compiler being used # filter out flags that are not appropriate for the compiler being used
function(target_compile_options_filtered target visibility) function(target_compile_options_filtered target visibility)
foreach( flag ${ARGN} ) foreach( flag ${ARGN} )
...@@ -26,9 +33,12 @@ endfunction() ...@@ -26,9 +33,12 @@ endfunction()
project(abc) project(abc)
if(READLINE_FOUND MATCHES TRUE) if(READLINE_FOUND MATCHES TRUE)
addprefix(READLINE_INCLUDES_FLAGS "-I" ${READLINE_INCLUDES}) addprefix(ABC_READLINE_INCLUDES_FLAGS "-I" ${READLINE_INCLUDES})
list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_INCLUDES=${READLINE_INCLUDES_FLAGS}") string(REPLACE ";" " " ABC_READLINE_INCLUDES_FLAGS "${ABC_READLINE_INCLUDES_FLAGS}")
list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_LIBRARIES=${READLINE_LIBRARIES}") list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_INCLUDES=${ABC_READLINE_INCLUDES_FLAGS}")
string(REPLACE ";" " " ABC_READLINE_LIBRARIES_FLAGS "${READLINE_LIBRARIES}")
list(APPEND ABC_READLINE_FLAGS "ABC_READLINE_LIBRARIES=${ABC_READLINE_LIBRARIES_FLAGS}")
elseif(READLINE_FOUND MATCHES FALSE) elseif(READLINE_FOUND MATCHES FALSE)
list(APPEND ABC_READLINE_FLAGS "ABC_USE_NO_READLINE=1") list(APPEND ABC_READLINE_FLAGS "ABC_USE_NO_READLINE=1")
endif() endif()
......
...@@ -73,13 +73,6 @@ ifndef ABC_USE_NO_READLINE ...@@ -73,13 +73,6 @@ ifndef ABC_USE_NO_READLINE
$(info $(MSG_PREFIX)Using libreadline) $(info $(MSG_PREFIX)Using libreadline)
endif endif
# whether to use libreadline
ifndef ABC_USE_NO_READLINE
CFLAGS += -DABC_USE_READLINE
LIBS += -lreadline
$(info $(MSG_PREFIX)Using libreadline)
endif
# whether to compile with thread support # whether to compile with thread support
ifdef ABC_USE_NO_PTHREADS ifdef ABC_USE_NO_PTHREADS
CFLAGS += -DABC_USE_PTHREADS CFLAGS += -DABC_USE_PTHREADS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment