Skip to content

Commit

Permalink
CMAKE: Fix readline import.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed Apr 11, 2024
1 parent ee52a02 commit 8b606e7
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions cmake-scripts/external-libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ if (ENABLE_READLINE)
else()
message(FATAL_ERROR "curses not found; will compile without curses")
endif()

pkg_check_modules(readline IMPORTED_TARGET readline)

if (readline_FOUND)
list(APPEND ASY_STATIC_LIBARIES PkgConfig::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
elseif(WIN32)
find_package(unofficial-pdcurses CONFIG)
if (unofficial-pdcurses_FOUND)
Expand All @@ -133,19 +142,17 @@ if (ENABLE_READLINE)
else()
message(FATAL_ERROR "curses not found; will compile without curses")
endif()

find_package(unofficial-readline-win32 CONFIG)
if (unofficial-readline-win32_FOUND)
list(APPEND ASY_STATIC_LIBARIES unofficial::readline-win32::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
else()
message(FATAL_ERROR "Only supported on Unix or Win32 systems")
endif()

# libreadline
pkg_check_modules(readline IMPORTED_TARGET readline)

if (readline_FOUND)
list(APPEND ASY_STATIC_LIBARIES PkgConfig::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
else()
message(STATUS "libreadline disabled; will not use libreadline")
endif()
Expand Down

0 comments on commit 8b606e7

Please sign in to comment.