[CMake] Simple question

Brad King brad.king at kitware.com
Thu Jan 27 09:03:22 EST 2005


Luca Cappa wrote:
> The warning is due to the fact that the variable CMAKE_CXX_FLAGS contains 
> some "-lXXXX" flags, which when passed as argumetns to the "distcc -c" 
> command they issue a warning saying that those arguments were ignored 
> since linking has not been done (and it's right :) ).
> 
> I simply resolved the problem by putting the ouput of "pkg-config 
> --cflags gtkmm" in the CMAKE_CXX_FLAGS

This part is fine.

> and the output of "pkg-config --libs gtkmm" in the 
> CMAKE_EXE_LINKER_FLAGS variable.

This will force it to use the libraries for all your executables.  If 
the --libs option produces only -lXXXX options (and not -Lxxxx) then you 
can put it in a variable like GTK_PKG_LIBS and do this:

TARGET_LINK_LIBRARIES(myexe ${GTK_PKG_LIBS})

If it does include -L options then you can use the STRING command's 
REGEX option to separate the -l and -L options and send the -L options 
to LINK_DIRECTORIES.

-Brad


More information about the CMake mailing list