FindCurses does not list menu.so in library variable
I'm not sure if this is a bug or my own stupidity. I'm working on an ascii project using ncurses and I wanted to try out the menu library. (like what is disscussed here)
My project uses cmake in the build process and works fine with ncurses. However, when I added in the menu header and call one of the functions it throws a linking error after compiling.
I took a look at the ${CURSES_LIBRARIES} variable provided by FineCurses and that lists paths to libncurses.so and libform.so (another ncurses companion library), but not libmenu.so. A quick search allowed me to add the line "list( APPEND LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libmenu.so" )" which "fixes" the issue, but this is obviously not portable.
So in summary using ${CURSES_INCLUDE_DIR} allows you to include menu.h, but ${CURSES_LIBRARIES} does not list the path to libmenu.so resulting in any function call to menu throwing a linking error. Manually adding the library to the list fixes the issue.
Solution is either:
- Add functionality to FineCurses that includes libmenu.so in ${CURSES_LIBRARIES}
- I'm an idiot and couldn't find the other way your suposed to find and include the menu library using cmake.
Info dump
- OS: linux ubuntu 16.04 64bit
- CMake version: 3.5.1 CMake suite maintained and supported by Kitware (kitware.com/cmake).
- Relevant CMakeLists.txt snippet:
cmake_minimum_required (VERSION 2.6)
project (SimpleRL)
find_package(Curses REQUIRED)
include_directories( ${CURSES_INCLUDE_DIR} )
set( LINK_LIBRARIES "" )
list( APPEND LINK_LIBRARIES ${CURSES_LIBRARIES} )
list( APPEND LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libmenu.so" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -g -Wall -Weffc++")
//note missing variables are what I set manually
add_executable( ${PROJECT_NAME} ${PROJECT_SOURCES} )
target_include_directories( ${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS} )
target_link_libraries( ${PROJECT_NAME} ${LINK_LIBRARIES} )
Any help is appreciated, thanks! And Thanks for maintaining such a great program. :)