Invalid handling of linker flags during build
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cmake (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When building a project using cmake, which contains a shared library, and any code which uses that shared library, such as test programs, installed application, or plug-ins for other applications or libraries, cmake incorrectly applies all of the linker flags from the shared library, to all of the resulting objects which depend on it. This makes using certain linker features, such as version scripts, very problematic.
This problem is then compounded when building with a builddir != srcdir setup, as the possible workaround of using a relative file name for --version-script and including an additional version script which exports all the symbols, cannot be used.
The linker flags for a shared library should never be copied over to the other targets which depend upon that library.
It sounds like you're trying to use target_ link_libraries to pass link flags that are not libraries. There is a separate target property for this:
http:// www.cmake. org/cmake/ help/v2. 8.11/cmake. html#prop_ tgt:LINK_ FLAGS