Skip to content

Commit

Permalink
Fix Linux-specific libtinfo shared object linker option
Browse files Browse the repository at this point in the history
  • Loading branch information
jeannotlanglois authored and wdoekes committed Aug 9, 2020
1 parent ab8ebd6 commit 5e4d725
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,36 @@ if(BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
endif(BUILD_STATIC)

find_library(CURSES_LIBRARY NAMES ncursesw cursesw ncurses curses)
find_package(PkgConfig QUIET) # import pkg_check_modules() and friends
if(PKG_CONFIG_FOUND)
pkg_search_module(CURSES_LIBRARY ncursesw cursesw ncurses curses)
if(CURSES_LIBRARY_FOUND)
set(CURSES_LIBRARY ${CURSES_LIBRARY_LIBRARIES})
endif()
pkg_search_module(TINFO_LIBRARY tinfo)
if(TINFO_LIBRARY_FOUND)
set(TINFO_LIBRARY ${TINFO_LIBRARY_LIBRARIES})
endif()
endif()
if(NOT CURSES_LIBRARY)
find_library(CURSES_LIBRARY NAMES ncursesw cursesw ncurses curses)
endif()
if(NOT TINFO_LIBRARY)
find_library(TINFO_LIBRARY NAMES tinfo)
endif()
if(CURSES_LIBRARY)
target_link_libraries(sipp dl ${CURSES_LIBRARY} pthread)
target_link_libraries(sipp_unittest dl ${CURSES_LIBRARY} pthread gtest gmock)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(NOT BUILD_STATIC)
if(TINFO_LIBRARY)
target_link_libraries(sipp dl ${TINFO_LIBRARY})
target_link_libraries(sipp_unittest dl ${TINFO_LIBRARY})
else()
message(FATAL_ERROR "libtinfo was not found -- please install package")
endif(TINFO_LIBRARY)
endif(NOT BUILD_STATIC)
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
else()
message(FATAL_ERROR "libcurses / libncurses was not found; please install devel package")
endif()
Expand Down

0 comments on commit 5e4d725

Please sign in to comment.