Fix build on systems with split ncurses/tinfo

On systems where ncurses is built with --with-termlib, libtinfo is a
separate library.

Building musikcube on such a system would fail with:

  ld: CMakeFiles/musikcube.dir/cursespp/App.cpp.o: undefined reference to symbol 'keypad'
  ld: /lib64/libtinfow.so.6: error adding symbols: DSO missing from command line

Using pkgconfig to look up the required link libraries resolves the issue.
This commit is contained in:
Torbjörn Lönnemark 2020-03-10 20:16:52 +01:00
parent f6b1847593
commit 53c5d84be0

View File

@ -78,7 +78,9 @@ add_definitions(-DNCURSES_WIDECHAR)
set_target_properties(musikcube PROPERTIES LINK_FLAGS "-Wl,-rpath,./")
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
target_link_libraries(musikcube ${musikcube_LINK_LIBS} ncursesw panelw musikcore)
find_package(PkgConfig)
pkg_check_modules(NCURSES REQUIRED ncursesw panelw)
target_link_libraries(musikcube ${musikcube_LINK_LIBS} ${NCURSES_LIBRARIES} musikcore)
else()
target_link_libraries(musikcube ${musikcube_LINK_LIBS} curses panel musikcore)
endif()