0

I am trying to install ncurses for a project that I'm working on.

I have written this CMake

cmake_minimum_required(VERSION 3.19)
project(FinalProject)

set(CMAKE_CXX_STANDARD 14)

find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
add_executable(FinalProject main.cpp)
target_link_libraries(FinalProject ${CURSES_LIBRARIES})

and it produces this error:

CMake Error at D:/JetBrains/CLion 2020.3.3/bin/cmake/win/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message): Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) Call Stack (most recent call first): D:/JetBrains/CLion 2020.3.3/bin/cmake/win/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE) D:/JetBrains/CLion 2020.3.3/bin/cmake/win/share/cmake-3.19/Modules/FindCurses.cmake:264 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:6 (find_package)

I also have included all the ncurses packages for minGW from the minGW installation manager, except for mingw32-libcurses (dev), which I cannot locate in the manager.

If you could point me where to look to fix this, I would really appreciate it.

  • 1
    Have you tried using `FindCurses`? https://cmake.org/cmake/help/latest/module/FindCurses.html Also use `message (STATUS ${CURSES_LIBRARIES})` to see whether CMake is managing to find it. One other option is to specify `CMAKE_PREFIX_PATH` - https://stackoverflow.com/a/31005939/1607937 Finally you could use `Find_Package` with `HINTS` but you may need to do some work with the output of that. – Den-Jason Jun 01 '21 at 15:04
  • @Den-Jason I got past that and the build finishes successfully, but still my main doesn't have access to curses I changed cmake to this ```cmake_minimum_required(VERSION 3.19) project(cursesPractice) set(CMAKE_CXX_STANDARD 14) add_executable(cursesPractice main.cpp) set(CURSES_LIBRARY "/opt/lib/libncurses.so") set(CURSES_INCLUDE_PATH "/opt/include") set(CURSES_NEED_NCURSES TRUE) find_package(Curses REQUIRED) if (CURSES_FOUND AND CURSES_HAVE_NCURSES_H) include_directories(${CURSES_INCLUDE_DIR}) target_link_libraries (target ${CURSES_LIBRARIES}) endif() ``` – Feanor Nosselo Jun 01 '21 at 18:13

0 Answers0