Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -15,6 +15,10 @@ add_subdirectory(unittests) add_subdirectory(lit) +configure_file( + ${LLDB_SOURCE_DIR}/include/lldb/Config/config.h.cmake + ${LLDB_BINARY_DIR}/include/lldb/Config/config.h) + if (NOT LLDB_DISABLE_PYTHON) # Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows) add_custom_target( finish_swig ALL Index: cmake/LLDBDependencies.cmake =================================================================== --- cmake/LLDBDependencies.cmake +++ cmake/LLDBDependencies.cmake @@ -141,7 +141,7 @@ list(APPEND LLDB_SYSTEM_LIBS edit) endif() if (NOT LLDB_DISABLE_CURSES) - list(APPEND LLDB_SYSTEM_LIBS panel ncurses) + list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES}) if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS}) endif() Index: cmake/modules/LLDBConfig.cmake =================================================================== --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -190,7 +190,7 @@ find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks") add_definitions( -DLIBXML2_DEFINED ) - list(APPEND system_libs xml2 ncurses panel) + list(APPEND system_libs xml2) list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY} ${DEBUG_SYMBOLS_LIBRARY}) @@ -276,3 +276,17 @@ else() set(LLDB_CAN_USE_DEBUGSERVER 0) endif() + +if (NOT LLDB_DISABLE_CURSES) + set(CURSES_NEED_NCURSES TRUE) + find_package(Curses REQUIRED) + + find_library(NCURSES_PANEL_LIBRARY NAMES panel DOC "The ncureses panel library") + if (CURSES_FOUND) + # Add panels to the library path + set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSES_PANEL_LIBRARY}) + endif () + + list(APPEND system_libs ${CURSES_LIBRARIES}) + include_directories(${CURSES_INCLUDE_DIR}) +endif () Index: include/lldb/Config/config.h.cmake =================================================================== --- /dev/null +++ include/lldb/Config/config.h.cmake @@ -0,0 +1,23 @@ +/* This generated file is for internal use. Do not include it from headers. */ + +#ifdef CONFIG_H +#error config.h can only be included once +#else +#define CONFIG_H + +/* Define to 1 if you have the header file. */ +#cmakedefine CURSES_HAVE_NCURSES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine CURSES_HAVE_NCURSES_NCURSES_H + +/* autotools compat */ +#ifdef CURSES_HAVE_NCURSES_H +#define HAVE_NCURSES_H 1 +#endif + +#ifdef CURSES_HAVE_NCURSES_NCURSES_H +#define HAVE_NCURSES_NCURSES_H 1 +#endif + +#endif // CONFIG_H Index: include/lldb/Config/config.h.in =================================================================== --- /dev/null +++ include/lldb/Config/config.h.in @@ -0,0 +1,14 @@ +/* This generated file is for internal use. Do not include it from headers. */ + +#ifdef CONFIG_H +#error config.h can only be included once +#else +#define CONFIG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_NCURSES_H + +#endif Index: source/Core/CMakeLists.txt =================================================================== --- source/Core/CMakeLists.txt +++ source/Core/CMakeLists.txt @@ -74,3 +74,5 @@ VMRange.cpp ) +include_directories(${CURSES_INCLUDE_DIR}) +target_link_libraries(lldbCore ${CURSES_LIBRARIES}) Index: source/Core/IOHandler.cpp =================================================================== --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -11,6 +11,7 @@ #include #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Config/config.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" @@ -29,8 +30,17 @@ #include "lldb/Target/ThreadPlan.h" #ifndef LLDB_DISABLE_CURSES + +#if defined(HAVE_NCURSES_H) #include #include +#elif defined(HAVE_NCURSES_NCURSES_H) +#include +#include +#else +#error No NCURSES header! +#endif + #endif using namespace lldb;