[CMake] link_libraries vs target_link_libraries
post at hendrik-sattler.de
Wed Nov 12 03:43:10 EST 2008
Colin D Bennett schrieb:
> However, I would argue that target_link_libraries vs.
> link_libraries is more important than the possible
> target_include_directories vs. include_directories, since the linked
> libraries will directly affect the generated output (linking to
> unnecessary libraries is wasteful). In contrast, including unused
> include-file-directories in the search path for the compiler will not
> affect the output (assuming there are no duplicated header file names
> in different paths, which I would argue should not be allowed).
Actually, it's possible that those duplicated names exist. The problem
comes up if they have the same API but a different ABI, thus the linking
will possibly fail.
However, doesn't include_directories() only affect the current dir and
the subdirs? It would be a very rare case to have two apps in the same
dir that use two different types/versions of the same include files.
More information about the CMake