From 53c5d84be051034b0a121229206a5a630b317594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= Date: Tue, 10 Mar 2020 20:16:52 +0100 Subject: [PATCH] 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. --- src/musikcube/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/musikcube/CMakeLists.txt b/src/musikcube/CMakeLists.txt index b05e4e9cc..d24c17840 100644 --- a/src/musikcube/CMakeLists.txt +++ b/src/musikcube/CMakeLists.txt @@ -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()