[CMake] check_function_exists

Hendrik Sattler post at hendrik-sattler.de
Fri May 30 12:42:53 EDT 2014



On 30. Mai 2014 17:36:41 MESZ, Christer Solskogen <christer.solskogen at gmail.com> wrote:
>Hi!
>
>I have a CMakefile with the following code:
>
>find_package(Readline)
>if(READLINE_FOUND)
>         set(CMAKE_REQUIRED_LIBRARIES "readline")
>         check_function_exists(rl_filename_completion_function 
>HAVE_RL_COMPLETION_FUNCTION)
>         if(HAVE_RL_COMPLETION_FUNCTION)
>                 set(HAVE_LIBREADLINE 1)
>         else()
>                 unset(READLINE_FOUND)
>         endif(HAVE_RL_COMPLETION_FUNCTION)
>         set(CMAKE_REQUIRED_LIBRARIES "")
>endif(READLINE_FOUND)
>
>
>If it finds libreadline.so it also finds the 
>rl_filename_completion_function. But it it finds libreadline.a it does
>not.
>
>-- Found READLINE: /usr/lib/x86_64-linux-gnu/libreadline.so
>-- Looking for rl_filename_completion_function
>-- Looking for rl_filename_completion_function - found
>-- Configuring done
>-- Generating done
>-- Build files have been written to: /home/hatari/temp
>
>-- Found READLINE: /usr/lib/x86_64-linux-gnu/libreadline.a
>-- Looking for rl_filename_completion_function
>-- Looking for rl_filename_completion_function - not found
>-- Configuring done
>-- Generating done
>-- Build files have been written to: /home/hatari/temp
>
>Both .a and .so have that function:
>
>hatari at friend:/usr/lib/x86_64-linux-gnu$ nm -D libreadline.so  | grep 
>rl_filename_completion_function
>000000000001abe0 T rl_filename_completion_function
>hatari at friend:/usr/lib/x86_64-linux-gnu$ nm libreadline.a | grep 
>rl_filename_completion_function
>00000000000015e0 T rl_filename_completion_function
>                  U rl_filename_completion_function
>
>
>Any hints?

Linking the static library may require additional link libraries for this test to succeed...

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.


More information about the CMake mailing list