[CMake] FindCurses.cmake does not find libncurses.so

aaron.meadows at thomsonreuters.com aaron.meadows at thomsonreuters.com
Tue Jun 14 12:16:16 EDT 2011


Looking at FindCurses.cmake, it looks like it will prefer libcurses if
it finds it (line 33).  Specifically, it will try to determine if
libcurses provides ncurses by seeing if libcurses contians the function
wsyncup() (line 60).  Here is the logic that does this (lines 47-71):

 

# Not sure the logic is correct here.

# If NCurses is required, use the function wsyncup() to check if the
library

# has NCurses functionality (at least this is where it breaks on
NetBSD).

# If wsyncup is in curses, use this one.

# If not, try to find ncurses and check if this has the symbol.

# Once the ncurses library is found, search the ncurses.h header first,
but

# some web pages also say that even with ncurses there is not always a
ncurses.h:

# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html

# So at first try ncurses.h, if not found, try to find curses.h under
the same

# prefix as the library was found, if still not found, try curses.h with
the 

# default search paths.

IF(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)

  INCLUDE(CheckLibraryExists)

  CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" 

    wsyncup "" CURSES_CURSES_HAS_WSYNCUP)

 

  IF(CURSES_NCURSES_LIBRARY  AND NOT  CURSES_CURSES_HAS_WSYNCUP)

    CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" 

      wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)

    IF( CURSES_NCURSES_HAS_WSYNCUP)

      SET(CURSES_USE_NCURSES TRUE)

    ENDIF( CURSES_NCURSES_HAS_WSYNCUP)

  ENDIF(CURSES_NCURSES_LIBRARY  AND NOT  CURSES_CURSES_HAS_WSYNCUP)

 

ENDIF(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES

 

I would suggest repeating that CHECK_LIBRARY_EXISTS() test and see if it
results true (which is what I would suspect the issue is).  Perhaps this
test is nolonger sufficent to distinquish if libcurses is providing
libncurses.

 

I could be dead wrong, of course, I'm kind of new to CMake.  

 

HTH!

 

Aaron C. Meadows 

 

-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of David Demelier
Sent: Tuesday, June 14, 2011 10:23 AM
To: cmake at cmake.org
Subject: [CMake] FindCurses.cmake does not find libncurses.so

 

Hello,

 

On FreeBSD the status of ncurses is particularly annoying. We have a old


curses lib under /usr/lib/libcurses.so that does not provide ncurses 

functionalities.

 

I tried the following CMakeLists.txt

 

cmake_minimum_required(VERSION 2.8)

project(cmaketest)

 

set(srcs "main.c")

 

set(CURSES_NEED_NCURSES TRUE)

find_package(Curses REQUIRED)

message(${CURSES_LIBRARY})

 

add_executable(test ${srcs})

 

But it does not find my /usr/local/lib/libncurses.so (this one is what I


want) it only stuck with /usr/lib/libcurses.so

 

I of course can link directly to it, but I don't like this way.

 

Cheers,

 

-- 

David Demelier

_______________________________________________

Powered by www.kitware.com

 

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

 

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

 

Follow this link to subscribe/unsubscribe:

http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110614/690cee81/attachment.htm>


More information about the CMake mailing list