[CMake] Mac OS X Framework support
William A. Hoffman
billlist at nycap.rr.com
Thu Dec 22 14:52:20 EST 2005
At 06:58 PM 12/21/2005, E. Wing wrote:
>> 1. Finding and using existing frameworks.
>>
OK, so after thinking about this some, reading emails, and
talking with some folks here at Kitware, I think I have figured out
the best way to do this.
FIND_LIBRARY, should be able to find frameworks. It will look at all the
NAMES specified, and look for name.framework in
the standard locations for frameworks on the mac. The result
will be to set the find library variable to the full path to the framework
root directory.
For example:
FIND_LIBRARY(FOO_LIBRARY NAMES foo )
Will search the following places for foo.framework,
(plus the normal cmake search paths):
~/Library/Frameworks
/Library/Frameworks
/System/Library/Frameworks
/Network/Library/Frameworks/
Lets say it finds ~/Library/Frameworks/foo.framework, then
FOO_LIBRARY=~/Library/Frameworks/foo.framework
Now, if you use FOO_LIBRARY like this:
TARGET_LINK_LIBRARIES(bar $${FOO_LIBRARY})
Then cmake will add -F~/Library/Frameworks to all
.o files in the target bar. Also, a -F~/Library/Frameworks
and -framework foo will be added to the link line
for bar.
-F will not be added if the framework is in
/Library/Frameworks
/System/Library/Frameworks
as these are always included by the compiler.
If you write a FindSomething.cmake module, you will use
the FIND_LIBRARY command to find frameworks, and not try to
use FIND_PATH to find include files buried in the framework.
The framework will be treated as a complete package, and cmake
will assume it contains the correct includes and libraries.
>> 2. Creating new frameworks. I suppose we could add support for
>> ADD_LIBRARY(foo FRAMEWORK ${srcs})
>> This would bundle a shared library into a framework as described here:
>>
For creating frameworks, a new type of library will be created FRAMEWORK.
Also, some additional target properties will be created so that you
can specify the include files that go with the framework.
SET_TARGET_PROPERTIES(foo PROPERTIES
FRAMEWORK_INCLUDES "foo.h;bar.h;car.h"
)
The framework structure will be created at build time, and copied
at install time.
Now the only thing left, is to implement this stuff!
Any volunteers?
-Bill
More information about the CMake
mailing list