set(CURSES_NEED_NCURSES TRUE)
-find_package(Curses REQUIRED)
+# libcurses may not be available on some platforms (e.g. Windows).
+find_package(Curses)
set(rbd_srcs
rbd.cc
journal
libneorados
librados
- ceph-common global ${CURSES_LIBRARIES}
+ ceph-common global
${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
+if(CURSES_FOUND)
+ target_compile_definitions(rbd PRIVATE HAVE_CURSES)
+ target_link_libraries(rbd ${CURSES_LIBRARIES})
+endif()
if(WITH_KRBD)
target_link_libraries(rbd
krbd)
#include "common/Formatter.h"
#include "common/TextTable.h"
#include "global/global_context.h"
+#ifdef HAVE_CURSES
#include <ncurses.h>
+#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
} // namespace iostat
+#ifdef HAVE_CURSES
namespace iotop {
class MainWindow {
};
} // namespace iotop
+#endif // HAVE_CURSES
void get_arguments_iostat(po::options_description *positional,
return 0;
}
+#ifdef HAVE_CURSES
void get_arguments_iotop(po::options_description *positional,
po::options_description *options) {
at::add_pool_options(positional, options, true);
return 0;
}
-Shell::Action stat_action(
- {"perf", "image", "iostat"}, {}, "Display image IO statistics.", "",
- &get_arguments_iostat, &execute_iostat);
Shell::Action top_action(
{"perf", "image", "iotop"}, {}, "Display a top-like IO monitor.", "",
&get_arguments_iotop, &execute_iotop);
+#endif // HAVE_CURSES
+
+Shell::Action stat_action(
+ {"perf", "image", "iostat"}, {}, "Display image IO statistics.", "",
+ &get_arguments_iostat, &execute_iostat);
} // namespace perf
} // namespace action
} // namespace rbd