Everything compiles.

The content in the CMAKE_REQUIRED_LIBRARIES var modifies the behavior of the 
CHECK_FUNCTION_EXISTS tests.

It seems that png library is required when checking for png_get_valid and 
png_set_tRNS_to_alpha. That var is not reset after those functions are tested 
and the calls looking for other system functions after this will fail if png is 
not found. (my case)

if(LIB_png)
   set(CMAKE_REQUIRED_LIBRARIES png)
endif(LIB_png)
CHECK_FUNCTION_EXISTS(png_get_valid          HAVE_PNG_GET_VALID)
CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha  HAVE_PNG_SET_TRNS_TO_ALPHA)

set(CMAKE_REQUIRED_LIBRARIES) #<-- need to add this
CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
CHECK_FUNCTION_EXISTS(snprintf               HAVE_SNPRINTF)
..

we need to reset the var before checking for the other functions.


> I made a small cmake test with:
>
> CHECK_FUNCTION_EXISTS( scandir HAVE_SCANDIR )
>
> and the function is found, so I will continue looking why the answer is 
> different with the FLTK cmake scripts.
>
>
>
>
> > Hi
> >
> > > Using CMake under Mac OS X should work with the latest svn (r. 9679).
> >
> > The problem is still there.
> >
> > CMake returns -- Looking for scandir - not found
> > when checking for the function in the CMakeLists.txt:
> >
> > CHECK_FUNCTION_EXISTS( scandir HAVE_SCANDIR )
> >
> > I'm trying to see why this fails.
> >
> > Compilers GCC 4.2.1 and Clang 4.0.
> >
> > I see you updated this part:
> > if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX AND NOT APPLE)
> >    set(MSG "POSIX compatible scandir")
> >    message(STATUS "Looking for ${MSG}")
> >    try_compile(V
> >       ${FLTK_BINARY_DIR}
> >       ${FLTK_SOURCE_DIR}/CMake/posixScandir.cxx
> >       )
> >    if(V)
> >       message(STATUS "${MSG} - found")
> >       set(HAVE_SCANDIR_POSIX 1 CACHE INTERNAL "")
> >    else()
> >       message(STATUS "${MSG} - not found")
> >       set(HAVE_SCANDIR_POSIX HAVE_SCANDIR_POSIX-NOTFOUND)
> >    endif(V)
> > endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX AND NOT APPLE)
> > mark_as_advanced(HAVE_SCANDIR_POSIX)
> >
> > If I compile posixScandir.cxx manually it compiles (with one warning, non 
> > void function without return), so scandir is found. But CMake was not 
> > testing that before the "AND NOT APPLE" modification because HAVE_SCANDIR 
> > is 0.
> >
> > I will continue with this.
> >
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to