Add option whether to link with libreadline or not
Reviewers: buda, mislav.bradac, mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D850
This commit is contained in:
parent
73052dcff4
commit
1cd83d2c19
@ -58,10 +58,13 @@ add_custom_target(clean_all
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# optional readline
|
# optional readline
|
||||||
find_package(Readline REQUIRED)
|
option(USE_READLINE "Use GNU Readline library if available (default ON). \
|
||||||
if (READLINE_FOUND)
|
Set this to OFF to prevent linking with Readline even if it is available." ON)
|
||||||
include_directories(SYSTEM ${READLINE_INCLUDE_DIR})
|
if (USE_READLINE)
|
||||||
add_definitions(-DHAS_READLINE)
|
find_package(Readline)
|
||||||
|
if (READLINE_FOUND)
|
||||||
|
add_definitions(-DHAS_READLINE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -265,7 +268,7 @@ set(memgraph_src_files
|
|||||||
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools
|
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools
|
||||||
antlr_opencypher_parser_lib dl glog gflags)
|
antlr_opencypher_parser_lib dl glog gflags)
|
||||||
if (READLINE_FOUND)
|
if (READLINE_FOUND)
|
||||||
list(APPEND MEMGRAPH_ALL_LIBS ${READLINE_LIBRARY})
|
list(APPEND MEMGRAPH_ALL_LIBS readline)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# STATIC library used by memgraph executables
|
# STATIC library used by memgraph executables
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
# READLINE_LIBRARY will be a path to the library.
|
# READLINE_LIBRARY will be a path to the library.
|
||||||
# READLINE_INCLUDE_DIR will be a path to the include directory.
|
# READLINE_INCLUDE_DIR will be a path to the include directory.
|
||||||
# READLINE_FOUND will be TRUE if the library is found.
|
# READLINE_FOUND will be TRUE if the library is found.
|
||||||
|
#
|
||||||
|
# If the library is found, an imported target `readline` will be provided. This
|
||||||
|
# can be used for linking via `target_link_libraries`, without the need to
|
||||||
|
# explicitly include READLINE_INCLUDE_DIR and link with READLINE_LIBRARY. For
|
||||||
|
# example: `target_link_libraries(my_executable readline)`.
|
||||||
if (READLINE_LIBRARY AND READLINE_INCLUDE_DIR)
|
if (READLINE_LIBRARY AND READLINE_INCLUDE_DIR)
|
||||||
set(READLINE_FOUND TRUE)
|
set(READLINE_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
@ -24,4 +29,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
mark_as_advanced(READLINE_LIBRARY READLINE_INCLUDE_DIR)
|
mark_as_advanced(READLINE_LIBRARY READLINE_INCLUDE_DIR)
|
||||||
|
add_library(readline SHARED IMPORTED)
|
||||||
|
set_property(TARGET readline PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${READLINE_INCLUDE_DIR})
|
||||||
|
set_property(TARGET readline PROPERTY IMPORTED_LOCATION ${READLINE_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
# optional readline
|
|
||||||
find_package(Readline)
|
|
||||||
if (READLINE_FOUND)
|
|
||||||
include_directories(SYSTEM ${READLINE_INCLUDE_DIR})
|
|
||||||
add_definitions(-DHAS_READLINE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set current directory name as a test type
|
# set current directory name as a test type
|
||||||
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||||
|
|
||||||
|
@ -36,9 +36,8 @@ disallow_in_source_build()
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# optional readline
|
# optional readline
|
||||||
find_package(Readline REQUIRED)
|
find_package(Readline)
|
||||||
if (READLINE_FOUND)
|
if (READLINE_FOUND)
|
||||||
include_directories(SYSTEM ${READLINE_INCLUDE_DIR})
|
|
||||||
add_definitions(-DHAS_READLINE)
|
add_definitions(-DHAS_READLINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ TIMEOUT=600 ./init
|
|||||||
bash -c "doxygen Doxyfile >/dev/null 2>/dev/null"
|
bash -c "doxygen Doxyfile >/dev/null 2>/dev/null"
|
||||||
|
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=release ..
|
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_READLINE=OFF ..
|
||||||
TIMEOUT=1000 make -j$THREADS
|
TIMEOUT=1000 make -j$THREADS
|
||||||
|
|
||||||
cd ../tools
|
cd ../tools
|
||||||
|
Loading…
Reference in New Issue
Block a user