Forgot your password?
From dd0e5455c017c441b9fd463002340df2d70a35a0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz <eschwartz@gentoo.org> Date: Wed, 24 Jul 2024 00:56:41 -0400 Subject: [PATCH] cmake: fix correctly linking to ncurses ncurses cannot simply be linked via -lncurses, especially if functions such as stdscr are used. Instead, fetch the required compiler and linker flags for ncurses by using pkg-config. On some systems (including Gentoo Linux) that e.g. includes -ltinfo as well. It also fixes detecting ncurses in nonstandard install directories. Signed-off-by: Eli Schwartz <eschwartz@gentoo.org> --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c021646..a7434c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,5 +105,7 @@ target_compile_definitions(fmail PUBLIC FMAIL) target_compile_definitions(ftools PUBLIC FTOOLS) target_compile_definitions(fconfig PUBLIC FSETUP) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(fconfig ncurses) -endif () \ No newline at end of file + include(FindPkgConfig) + pkg_check_modules(NCURSES REQUIRED IMPORTED_TARGET GLOBAL ncurses) + target_link_libraries(fconfig PkgConfig::NCURSES) +endif () -- 2.44.2