[CMake] Frameworks and FIND_FILE

Bill Hoffman bill.hoffman at kitware.com
Mon Dec 26 15:25:27 EST 2005


I can make FIND_FILE(FOO foo.h) find foo.h in installed frameworks,
the globing approach works well, and is fast enough.
However, I am not sure what to do with it.   I think there is not choice
but to add some extra MAC specific syntax to FIND_FILE.

Here is the problem, lets say we have this:

/System/Library/Frameworks/foo.framework/Headers/foo.h

So, we do this:

FIND_PATH(FOO foo.h)

I have no problem finding foo.h in foo.framework/Headers/foo.h.
The question is what to do with it?

As I see it my options for setting FOO are:

1. FOO=/System/Library/Frameworks/foo.framework
If INCLUDE_DIRECTORIES see something like this, then it adds
a -F/System/Library  instead of the usual -I.

2. FOO=/System/Library/Frameworks/foo.framework/Headers
If INCLUDE_DIRECTOIRES sees this, it just adds a 
-I/System/Library/Frameworks/foo.framework/Headers

However, previous emails show the problem with either of these assumptions,
sometimes you want 1, and sometimes you want 2.  So, there will
have to be specific syntax to take care of this.  However, this means
that Find*.cmake authors will have to be Mac/Framework aware...
It sounds like by default, cmake should do option 1.   This way existing
Find*.cmake stuff will work if the code uses frameworks as indented on
the Mac, no -I into framework guts, just -F and -framework.  This will
avoid namespace problems.

For case 2, we are going to have to tell FIND_PATH that it should return
a path that is inside the framework structure.

Something like this:
FIND_PATH(FOO FRAMEWORK_INTERNAL foo.h )

Which will use the same searching done in 1. but will return:
FOO=/System/Library/Frameworks/foo.framework/Headers for the path.


BTW, I just checked in some changes to FIND_LIBRARY that now
make it framework aware, and it seems to work well.

-Bill

 



More information about the CMake mailing list