[CMake] add_subdirectory and link_directories

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Tue Jan 11 04:27:02 EST 2011


Hello,

On Tue, 11 Jan 2011 01:42:47 +0100
Michael Hertling <mhertling at online.de> wrote:

> Since CMake prefers to specify libraries by path instead of using
> -l/-L or the like, there's usually no need for the LINK_DIRECTORIES()
> command, IMO.

Sorry to jump into the discussion, but I'm having a problem that I
think is related to that.

I have an application that links against Qt and another library which
is found using pkg-config (and the PkgConfig CMake module). Due to the
fact that I'm cross-compiling, the library is in a non-standard
location (i.e: $HOME/something/usr/lib instead of /usr/lib).
Unfortunately, the xxx_LIBRARIES variable filled by the PkgConfig
module only contains "-lfoobar". So I'd like to either :

 *) Tell the PkgConfig module to add the full path to the library, which
    it seems is the CMake way of doing things.

 *) Tell CMake about this $HOME/something/usr/lib path for which a -L
    flag should be added. I've tried changing LINK_DIRECTORIES, but it
    then completely breaks the build.

Any clue ?

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


More information about the CMake mailing list