[CMake] Out-of-project link library problem
Andrew Sayman
andrew.sayman at gmail.com
Wed Sep 3 20:16:38 EDT 2008
On Wed, Sep 3, 2008 at 7:57 PM, Christopher Harvey
<chris at basementcode.com> wrote:
> try getting rid of quotes
Getting rid of the quotes doesn't change anything.
> putting them all in a single command.
This isn't helpful without removing all of the benefits of the CMake
standard modules. If I wanted to hard code every library requirement I
would. I'd rather not have to maintain a bunch of separate lists for
each build machine and build OS however. A better example of what I'm
doing, rather than just what triggers this bug, might be the
following:
target_link_libraries( my_project m crypt pthread ) # Needed either way
if( USER_OPTION_X11 )
include( FindX11 )
target_link_libraries( my_project ${X11_LIBRARIES} )
endif( USER_OPTION_X11 )
if( USER_OPTION_GTK )
include( FindPkgConfig )
pkg_check_modules( GTK REQUIRED gtk+-2.0 )
target_link_libraries( my_project ${GTK_LIBRARIES} )
endif( USER_OPTION_GTK )
In this case my project needs m, crypt, and pthread no matter what.
Both X11_LIBRARIES and GTK_LIBRARIES also have m and pthread as part
of their required libs. This creates a redundancy and the libraries
for all three are listed multiple times with the gtk libraries being
repeated the most.
--
Andrew Sayman
Jabber: lorien420 at jabber.org
More information about the CMake
mailing list