Simplify readline linking

Link readline directly into epee; having a separate epee_readline
library is not saving anything since we have it widely linked anyway.
Conditionally linking it to epee simplifies a bit of CMake code.

Also simplify how epee detects cmake to just look for a `readline`
target, which we now only set up if we find readline in the top-level
CMakeLists.txt
This commit is contained in:
Jason Rhinelander 2020-05-20 00:36:26 -03:00
parent 92c7d7fe34
commit b1cad5ced9
7 changed files with 6 additions and 21 deletions

View File

@ -889,8 +889,6 @@ if (WIN32)
target_link_libraries(extra INTERFACE setupapi)
endif()
add_library(readline INTERFACE)
if (BUILD_INTEGRATION)
target_compile_definitions(extra INTERFACE LOKI_ENABLE_INTEGRATION_TEST_HOOKS)
else()
@ -898,7 +896,8 @@ else()
if(USE_READLINE AND NOT DEPENDS)
find_package(Readline)
if(READLINE_FOUND AND GNU_READLINE_FOUND)
target_link_libraries(readline INTERFACE ${GNU_READLINE_LIBRARY} epee_readline)
add_library(readline INTERFACE)
target_link_libraries(readline INTERFACE ${GNU_READLINE_LIBRARY})
target_include_directories(readline INTERFACE ${Readline_INCLUDE_DIR})
target_compile_definitions(readline INTERFACE HAVE_READLINE)
message(STATUS "Found readline library at: ${GNU_READLINE_LIBRARY}")
@ -909,6 +908,7 @@ else()
find_path(Readline_INCLUDE_PATH readline/readline.h)
find_library(Readline_LIBRARY readline)
find_library(Terminfo_LIBRARY tinfo)
add_library(readline INTERFACE)
target_link_libraries(readline INTERFACE ${Readline_LIBRARY} ${Terminfo_LIBRARY})
target_include_directories(readline INTERFACE ${Readline_INCLUDE_PATH})
target_compile_definitions(readline INTERFACE HAVE_READLINE)

View File

@ -29,15 +29,9 @@
add_library(epee hex.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp memwipe.c
connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp portable_storage.cpp)
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
add_library(epee_readline readline_buffer.cpp)
target_link_libraries(epee_readline
PUBLIC
easylogging
readline
)
else()
add_library(epee_readline INTERFACE)
if (TARGET readline)
target_sources(epee PRIVATE readline_buffer.cpp)
target_link_libraries(epee PUBLIC readline)
endif()
set_property(SOURCE memwipe.c PROPERTY C_STANDARD 11)
@ -51,10 +45,6 @@ if (BUILD_GUI_DEPS)
endif()
install(TARGETS epee
ARCHIVE DESTINATION ${lib_folder})
if (USE_READLINE AND GNU_READLINE_FOUND)
install(TARGETS epee_readline
ARCHIVE DESTINATION ${lib_folder})
endif()
endif()
target_link_libraries(epee

View File

@ -75,7 +75,6 @@ target_link_libraries(common
Boost::regex
OpenSSL::SSL
OpenSSL::Crypto
epee_readline
extra)
target_include_directories(common PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../../translations")

View File

@ -44,7 +44,6 @@ target_link_libraries(daemon
daemonizer
serialization
daemon_rpc_server
epee_readline
version
Boost::chrono
Boost::filesystem

View File

@ -37,7 +37,6 @@ target_link_libraries(gen_multisig
rpc_commands
cryptonote_core
epee
epee_readline
Boost::chrono
Boost::program_options
Boost::filesystem

View File

@ -37,7 +37,6 @@ target_link_libraries(simplewallet
rpc_commands
cryptonote_core
mnemonics
epee_readline
Boost::chrono
Boost::program_options
Boost::filesystem

View File

@ -62,7 +62,6 @@ target_link_libraries(wallet_rpc_server
PRIVATE
wallet
daemonizer
epee_readline
Boost::program_options
Boost::regex
extra)