[CMake] Get linker flags / include directories for a library target

Unknown ax487 at gmx.de
Thu Dec 20 17:14:17 EST 2018


Dear community,

I have been wondering on multiple occasions about how to get the
linker flags (i.e. all -llib -Ldir) and include flags (-Idir)
for a library (i.e. a target added to the project using 
add_library) within a cmake.

There are many cases in which the flags are required, noticeably
generating a suitable pkg-config file or creating a wrappers around
C/C++ libraries.

I think that it should be possible to derive the flags from
some of the target properties of the library, but I don't
know exactly how.

Could you give me a hand?

ax487



More information about the CMake mailing list