Skip to content

Commit

Permalink
Add ncurses hello world app
Browse files Browse the repository at this point in the history
- Bump CMake version to 3.17
- Require ncurses
- Include ncurses libraries

Signed-off-by: Pavel Kalugin <paul.kalug@gmail.com>
  • Loading branch information
p4vook committed Dec 6, 2020
1 parent 694715a commit 927f95a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.17)
project(rang)

set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)

add_subdirectory(src)
target_include_directories(rang PRIVATE include)

target_include_directories(rang PUBLIC include)
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
add_executable (rang rang.cpp)

target_include_directories(rang PUBLIC ${CURSES_INCLUDE_DIRS})
target_link_libraries(rang PUBLIC ${CURSES_LIBRARIES})
8 changes: 6 additions & 2 deletions src/rang.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include "rang.h"
#include <iostream>
#include <ncurses.h>

int main(int argc, char *argv[])
{
std::cout << rang::MESSAGE;
initscr(); /* Start curses mode */
printw(rang::MESSAGE.c_str()); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}

0 comments on commit 927f95a

Please sign in to comment.