[cmake-developers] Automatic -F addition for frameworks?

Brad King brad.king at kitware.com
Wed Jul 10 11:09:52 EDT 2013


On 07/10/2013 10:46 AM, Stephen Kelly wrote:
>  target_link_libraries(sometarget 
>    LINK_PUBLIC /path/to/prefix/lib/QtCore.framework/QtCore)
> 
> I can use #include <QtCore/QString> without using any addtional commands to 
> add include directories.
[snip]
> The question is whether this is a worthwhile feature for cmake?

I'm not sure how much everyone knows about the history of this so
here is a summary as I understand it.  If anyone has corrections
please post.

Back before CMake 2.6 we used to split all library full paths like
"/path/to/libfoo.a" into "-L/path/to -lfoo".  This was done for
frameworks too such that "/path/to/foo.framework" would become
"-F/path/to -framework foo".  When we switched to full paths for
libraries frameworks were left alone.

Really find_library should never find "foo.framework" but always
"foo.framework/foo".  However, this was done incorrectly because
no one really understood frameworks when support was first added.
Thus there is special handling for "foo.framework" paths like
that in cmComputeLinkInformation::AddFrameworkItem.  Such paths
are recognized, split into -F/-framework, and also used for
include directories.

IIUC currently real library paths like foo.framework/foo have no
special handling right now.  They are (correctly) not split and
there is no include directory added for them.  In other words,
if we had simply done find_library right for frameworks originally
then no special handling would be needed for frameworks at all.

So, the question is: do we want to add *new* special handling for
library paths inside frameworks to also add include directories?
I think this makes sense as long as it is only for raw paths and
not imported targets (which can solve this with usage reqs).  Any
project depending on this will already have platform-specific
code to #include with the framework name.

-Brad



More information about the cmake-developers mailing list