[CMake] problem with CHECK_FUNCTION_EXISTS() and CMAKE_REQUIRED_LIBRARY

William A. Hoffman billlist at nycap.rr.com
Mon Jan 16 15:14:51 EST 2006


At 12:06 PM 1/14/2006, Alexander Neundorf wrote:
>Hi, 
> 
>I want to check for a function which isn't part of libc, but of libutil. 
>I tried this: 
> 
>INCLUDE(CheckFunctionExists) 
>SET(CMAKE_REQUIRED_LIBRARIES util) 
>CHECK_FUNCTION_EXISTS(openpty "" HAVE_OPENPTY) 
>#SET(CMAKE_REQUIRED_LIBRARIES) # should I reset it here again ? 
>MESSAGE(STATUS "have_openpty: ${HAVE_OPENPTY}") 
> 


That should be:
CHECK_FUNCTION_EXISTS(openpty HAVE_OPENPTY) 

cmake --help-module CheckFunctionExists
cmake version 2.3-20060116
  CheckFunctionExists
       macro which checks if the function exists

       CHECK_FUNCTION_EXISTS(FUNCTION VARIABLE)

         FUNCTION - the name of the function
         VARIABLE - variable to store the result

       If CMAKE_REQUIRED_FLAGS is set then those flags will be passed into
       the compile of the program likewise if CMAKE_REQUIRED_LIBRARIES is set
       then those libraries will be linked against the test program

I suppose there should be a check for an empty variable which is what you gave it.

-Bill




More information about the CMake mailing list