Commit 5c7a6228 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix build with LDFLAGS=--Wl,--as-needed on Linux

parent cd94452e
......@@ -79,7 +79,7 @@ MACRO (MYSQL_CHECK_MULTIBYTE)
ENDMACRO()
MACRO (FIND_CURSES)
INCLUDE (FindCurses)
FIND_PACKAGE(Curses)
MARK_AS_ADVANCED(CURSES_CURSES_H_PATH CURSES_FORM_LIBRARY CURSES_HAVE_CURSES_H)
IF(NOT CURSES_FOUND)
SET(ERRORMSG "Curses library not found. Please install appropriate package,
......@@ -104,6 +104,18 @@ MACRO (FIND_CURSES)
SET(CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE)
SET(CURSES_CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# -Wl,--as-needed breaks linking with -lcurses, e.g on Fedora
# Lower-level libcurses calls are exposed by libtinfo
CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} tputs "" HAVE_TPUTS_IN_CURSES)
IF(NOT HAVE_TPUTS_IN_CURSES)
CHECK_LIBRARY_EXISTS(tinfo tputs "" HAVE_TPUTS_IN_TINFO)
IF(HAVE_TPUTS_IN_TINFO)
SET(CURSES_LIBRARY tinfo)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
MACRO (MYSQL_USE_BUNDLED_READLINE)
......
......@@ -18,7 +18,7 @@ INCLUDE(CheckIncludeFile)
include(CheckFunctionExists)
CHECK_INCLUDE_FILES(term.h HAVE_TERM_H)
SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_CURSES_LIBRARY})
SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
CHECK_CXX_SOURCE_COMPILES("
#include <term.h>
int main()
......
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