[CMake] Re: Frameworks and FIND_FILE
William A. Hoffman
billlist at nycap.rr.com
Tue Dec 27 15:31:28 EST 2005
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.
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.
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
-Bill
More information about the CMake
mailing list