title: Undefined reference during linking using ncurses and cmake
body: <p>I am trying to use ncurses in my C++-Program by including the following headers:</p>
  
  <pre><code>#include &lt;curses.h&gt;
  #include &lt;menu.h&gt;
  #include &lt;stdlib.h&gt;
  </code></pre>
  
  <p>I am using CLion IDE and this is my CMakeList.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(LearnC)
  
  set(CURSES_USE_NCURSES TRUE)
  find_package(Curses REQUIRED)
  include_directories(${CURSES_INCLUDE_DIR})
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  
  set(SOURCE_FILES main.cpp)
  add_executable(LearnC ${SOURCE_FILES})
  target_link_libraries(LearnC ${CURSES_INCLUDE_DIR})
  </code></pre>
  
  <p>Compilation goes well however while linking I am getting these errors:</p>
  
  <pre><code>[ 20%] Linking CXX executable LearnC
  CMakeFiles/LearnC.dir/main.cpp.o: In function `main':
  ../LearnC/main.cpp:20: undefined reference to `initscr'
  ../LearnC/main.cpp:22: undefined reference to `clear'
  ../LearnC/main.cpp:23: undefined reference to `noecho'
  ../LearnC/main.cpp:24: undefined reference to `curs_set'
  ../LearnC/main.cpp:25: undefined reference to `cbreak'
  ../LearnC/main.cpp:26: undefined reference to `nl'
  ../LearnC/main.cpp:27: undefined reference to `stdscr'
  ../LearnC/main.cpp:27: undefined reference to `keypad'
  </code></pre>
  
  <p>What can I do to fix this?</p>