[CMake] Re: Frameworks and FIND_FILE

E. Wing ewmailing at gmail.com
Wed Dec 28 13:47:42 EST 2005


On 12/27/05, William A. Hoffman <billlist at nycap.rr.com> wrote:
> OK, I have checked in support for frameworks in FIND_FILE, and FIND_LIBRARY.
> It works like this:
>
> Assume we have some framework foo, with
> /System/Library/Frameworks/foo.framework/Headers/foo.h
>
> FIND_FILE(FOO foo.h)  --  Sets FOO to
> /System/Library/Frameworks/foo.framework/Headers
>
> FIND_FILE(FOOFRAME foo/foo.h) -- Sets FOOFRAME to
> /System/Library/Frameworks/foo.framework
>
> FIND_LIBRARY(FOOLIB foo)  -- Sets FOOLIB to
> /System/Library/Frameworks/foo.framework
>
> ADD_EXECUTABLE(bar bar.c)
>
> TARGET_LINK_LINBRARY(bar ${FOOLIB}) - foreach .o that is part of bar
> -F/System/Library is added
> to the compile line.  For linking -F/System/Library and -framework foo are
> added to the link line.
>
>
> INCLUDE_DIRECTORIES(${FOO}) -- Adds a
> -I/System/Library/Frameworks/foo.framework/Headers
> to the compile line.
>
> INCLUDE_DIRECTORIES(${FOOFRAME}) -- Adds a -F/System/Library to the compile
> line.
>

Okay, sounds very good. I'll try to get to testing later today by
attempting to port some of my Find*.cmake scripts.

> It will only add a -F once, duplicates are removed.  Also, I did not stop it
> from
> adding -F for system locations like /System/Library because it does not
> cause a
> warning, and is more simple.

This is probably okay. You definately will want the -F for the other
search paths because the Universal SDK tries to remap the search
paths. I'm not sure how /System is going to react though since /System
is the one that has to be remapped. But I guess we can worry about
that later when we focus on the Universal Binary stuff.


> In searching for frameworks, the following search order is used:
>
> (path listed in command)
> $(CMAKE_LIBRARY_PATH)
> $(PATH)
> ~/Library/Frameworks
> /Library/Frameworks
> /System/Library/Frameworks
> /Network/Library/Frameworks
>

One minor thing, I think /Network/Library/Frameworks should be
searched before /System/Library/Frameworks. I'm not totally sure about
this though so I could be wrong. Only Apple frameworks are supposed to
go in /System/Library/Frameworks, so I think the /Network directory is
supposed to be searched before it just in case you need one last
chance to override the system installed one. (For example, OpenAL is
currently in flux due to the 1.1 migration. Since Apple open sourced
their implementation, we are encouraged to build our own version and
override theirs until they can finish and ship a 1.1 for the official
OS.)

So I think the order should be:
~/Library/Frameworks
 /Library/Frameworks
 /Network/Library/Frameworks
 /System/Library/Frameworks

Nobody I know actually has setup a network share like this though so I
don't know anybody with practical experience with this.

Thanks,
Eric


More information about the CMake mailing list