On Friday, November 26, 2010 02:38:52 am Pertti Kellomäki
wrote:
> line. We are using cmake, and give the X libraries using
> the following line in CMakeLists.txt:
>
> set(CMAKE_EXE_LINKER_FLAGS "-lX11 -lXtst -lXi")
>
> This produces the offending command line in Makefile:
>
> /usr/bin/gcc -Wall -m32 -lX11 -lXtst -lXi
> CMakeFiles/fala_pixelchanged.dir/main.c.o -o
> fala_pixelchanged
I don't think that's what CMAKE_EXE_LINKER_FLAGS is for.
It's for setting /flags/ -- not for specifying which link
libraries you're using. It's supposed to hold stuff like "-
L/usr/local/lib -L. -L.." or something.
You're supposed to declare linking like this:
ADD_EXECUTABLE( fala_pixelchanged
...list of sources...
)
TARGET_LINK_LIBRARIES( fala_pixelchanged
-lX11 -lXtst -lXi
)
However, an even better way would be to use the FindX11
module like this
FIND_PACKAGE(X11 REQUIRED)
ADD_EXECUTABLE( fala_pixelchanged
...list of sources...
)
TARGET_LINK_LIBRARIES( fala_pixelchanged
${X11_LIBRARIES}
)
> The reason for the linker complaints is that the X
> libraries precede main.c.o in the command line. At the
> point where the linker sees the libraries, there are no
> references to symbols in them, so the linker just
> discards the libraries.
As Thaigo said, it's indended to work this way.
-gabriel
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev