[Cmake] -lfltkFOO order
Mark Foskey
mark_foskey at unc.edu
Thu Mar 13 13:27:54 EST 2003
FindFLTK.cmake doesn't seem to load the FLTK libraries in the proper
order. I compiled a simple program with the following CMakeList.txt file:
PROJECT(choosefile)
INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindJPEG.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindPNG.cmake)
LINK_LIBRARIES(
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${FLTK_LIBRARIES}
)
ADD_EXECUTABLE( choosefile choosefile.cxx )
I got the following error message:
Building executable choosefile...
c++ -fPIC choosefile.o -o choosefile -rdynamic -L/usr/local/lib
-L/usr/
X11R6/lib -ljpeg -lpng -lz -lfltk -lfltk_gl -lfltk_forms -lfltk_images
-lSM -lIC
E -lX11 -lXext -lm -Wl,-rpath,/usr/local/lib:/usr/X11R6/lib
/usr/local/lib/libfltk_images.a(Fl_File_Icon2.o): In function
`Fl_File_Icon::loa
d(char const*)':
Fl_File_Icon2.o(.text+0xe): undefined reference to `fl_filename_ext(char
const*)
'
The problem was that -lfltk_images needed to come before -lfltk. There
is a utility with Unixoid versions, fltk_config, that will output the
needed libraries:
$ fltk-config --use-gl --use-images --use-glut --use-forms --ldflags
-L/usr/local/lib -lfltk_images -lpng -ljpeg -lz -lfltk_gl -lGLU -lGL
-lfltk_forms -lfltk -L/usr/X11R6/lib -lm -lXext -lX11 -lsupc++
I don't know if there is a way for cmake to automatically call this
program, or if such a thing would even be desirable. But the
FindFLTK.cmake module should probably be fixed.
Finally, fltk_images reqires some image libraries, and fltk_gl wants GLU
and GL. Should the FindFLTK.cmake module find thos modules too? What's
the philosophy on that?
--
Mark Foskey (919) 843-5436 Computer-Aided Diagnosis and Display Lab
mark_foskey at unc.edu Department of Radiology, CB 7515, UNC
http://www.cs.unc.edu/~foskey Chapel Hill, NC 27599-7515
More information about the CMake
mailing list