[CMake] question about linker flags from PKGCONFIG

Brad King brad.king at kitware.com
Wed Jul 5 10:43:01 EDT 2006


Andriy Rysin wrote:
> Hi
> 
> I've got a question about PKGCONFIG usage
> Let's say I've got SOMELIB_CFLAGS and SOMELIB_LD_FLAGS from PKGCONFIG by
> this:
> 
> PKGCONFIG(somelib SOMELIB_INCLUDE_DIR SOMELIB_LINK_DIR SOMELIB_LD_FLAGS
> SOMELIB_CFLAGS)
> 
> I could use
> SET(CMAKE_CXX_FLAGS "${SOMELIB_CFLAGS} ${CMAKE_CXX_FLAGS}")
> to set includes for that dir

Alternatively you can use the STRING command to extract the directories 
from the -I options and then use INCLUDE_DIRECTORIES.  This would allow 
those include directories to be included in dependency scanning.

 > but I could not find any CMAKE_LD_FLAGS to
> add SOMELIB_LD_FLAGS to, so that I've got my library included on linking
> stage

CMAKE_C_LINK_FLAGS
CMAKE_CXX_LINK_FLAGS

or use SET_TARGET_PROPERTIES to set a LINK_FLAGS property on a specific 
target.

-Brad


More information about the CMake mailing list