[CMake] FindX11.cmake needs some work for 2.6.0
Bill Hoffman
bill.hoffman at kitware.com
Mon Apr 14 21:55:21 EDT 2008
Alan W. Irwin wrote:
> On some platforms, X11_LIBRARIES derived by FindX11.cmake is going to be a
> mixture of full pathnames for libraries and a series of -l flags which is
> not a recommended form for CMake 2.6.x. To see this, look at the
> FindX11.cmake logic for CMake-2.6.0-RC-8.
>
OK, -l flags are fine with cmake 2.6.x, let me say that again, -l is OK
with 2.6. It MAY cause a link error. If you set CMP0003 to NEW, it you
can find out. If CMP0003 is set to NEW and you stuff links, that is not
a hack, that is the right way to do it. We just did not want to break
projects by default. We wanted to warn by default, and give a way to
silence the warning. You do not have to use a full path.
> The preliminary version of X11_LIBRARIES is fullpath only since that is
> derived using FIND_LIBRARY, but then more libraries are added to this list
> as follows:
>
> SET(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
>
> X11_X_PRE_LIBS is also fullpath since it is the result of FIND_LIBRARY, but
> X11_X_EXTRA_LIBS (empty on my Debian testing system) potentially has
> lots of
> -l flags such as -lnsl_s -linet -ldnet, etc. if you follow the
> X11_X_EXTRA_LIBS logic in FindX11.cmake.
>
> Could somebody please change FindX11.cmake so that X11_X_EXTRA_LIBS is
> always determined with FIND_LIBRARY? This would make it and X11_LIBRARIES
> consistently fullpath on all platforms.
I don't think I am going to make a change for 2.6 like this as it is
likely not to work every where it does now. Also, it is not required
to have full paths.
>
> I think these -l forms of libraries just slipped through as some ancient
> (autoconf?) boilerplate for X11_X_EXTRA_LIBS that has propagated to all
> FindX11.cmake versions in contradiction to the recommendation that
> libraries
> are supposed to be in fullpath form for 2.6.x.
>
> Furthermore, making X11_LIBRARIES fullpath would benefit the PLplot build
> (and presumably other builds as well). When first setting up the
> CMake-based
> build system for PLplot, I either copied from our previous autotools-based
> build system or I may have noticed the potential for -l flags in
> X11_LIBRARIES. But in any case, I prepended X11_LIBRARIES with
> "-L${X11_LIBRARY_DIR}" so that our users could have a non-standard install
> location for X (especially important for this era of frantic X development
> activity where some X testers may have multiple versions of X installed on
> their platform). However, this -L flag leads to CMP0003 warnings for the
> 2.6.0 release candidate since fullpath libraries are preferred for 2.6.x.
> (Also, X11_LIBRARY_DIR is an undocumented variable for FindX11.cmake which
> I would prefer not to depend upon in the long term.)
>
> Of course, there are workaround for CMP0003 warnings, but the clean
> solution
> would be if a CMake developer would simply change FindX11.cmake in cmake
> cvs
> and also for 2.6.0 so that X11_X_EXTRA_LIBS and therefore X11_LIBRARIES are
> always consistently fullpath. That would allow me to stop prepending
> "-L${X11_LIBRARY_DIR}" to X11_LIBRARIES which would eliminate the CMP0003
You should never use -L directly..... link_directories should be used.
> warnings without compromising the need of some who require a non-standard
> install location for X.
>
I guess I would suggest that you should experiment with a new version of
FindX11 in plplot. If you find it works well, we can look at it for
inclusion in 2.6.1. In the long run full paths would be a good idea for
FindX11, but not a requirement right now.
Thanks.
-Bill
More information about the CMake
mailing list