Wireshark-dev: [Wireshark-dev] CMake can't find glib
From: Stephen Fisher <[email protected]>
Date: Fri, 27 Jan 2012 11:46:55 -0700
I'm anxious to try out the beginnings of a Qt Wireshark, but I'm having trouble with CMake on FreeBSD.  After making a separate directory to bulid in, and running "cmake ../wireshark" I get to this point;

     /usr/bin/ld: cannot find -lglib-2.0
     *** Error code 1

As far as I can tell, the reason is that the glib library is in a non-standard search location for ld (/usr/local/lib).  The only way I've found so far to work around this problem is to add this to wsutil/CMakeLists.txt:

     link_directories(
          /usr/local/lib
     )

This appears to be because cmake/modules/FindGLIB2.cmake doesn't set anything for the *library* include directories... only the header include directories (GLIB2_INCLUDE_DIRS).

Any hints on how to automatically add this via the FindGLIB2.cmake file?

P.S. After the workaround above, I run into a separate error that reminds me of a problem we fixed a while back with autotools when using older versions of Flex (my /usr/local/bin/flex which is version 2.5.35 doesn't have this problem, whereas the default system installed version of 2.5.4 [FreeBSD 9.0-RELEASE] has this problem):

     Linking C shared library ../lib/libwsutil.so
     [  2%] Built target wsutil
     [  2%] Generating ascend_scanner.c
     /usr/bin/flex: unknown flag '-'.  For usage, try
             /usr/bin/flex --help