I'm building a school project application which requires the use of ncurses library. While trying to use mvwaddwstr()
function, I get the following error: undefined reference to `mvwaddwstr'
.
My CMake configuration file is as follows:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_C_STANDARD 11)
project(client)
# Libraries
find_package(Curses REQUIRED)
find_package(Threads REQUIRED)
include_directories(${CURSES_INCLUDE_DIRS})
# Sources
set(CLIENT_SOURCE_FILES
main.c)
# Links
add_library(client_library ${CLIENT_SOURCE_FILES})
add_executable(client ${CLIENT_SOURCE_FILES})
target_link_libraries(client ${CURSES_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(client INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
Edit
As suggested I tried adding:
set(CURSES_NEED_NCURSES TRUE)
set(CURSES_NEED_WIDE TRUE)
include(FindCurses)
before the find_package
line but it still ain't working.