[CMake] Xcode generation, transformation of framework includes to -F
James Turner
zakalawe at mac.com
Wed Jun 20 09:42:00 EDT 2012
I've encountered a problem with OSX framework detection, I think exposed due to updating to Xcode 4.3.3 (was previously using 4.3.2), though I'm sure the real issue is actually in my cmake-files.
It appears that /Library/Frameworks is no longer searched by default (this makes sense for better SDK support), but the code in the XCode project generator to transform include paths to framework search paths isn't being invoked due to how I'm detecting the paths (i.e logic starting around line 1928 of cmGlobalXCodeGenerator)
I have a custom framework /Library/Frameworks/ALUT.framework, and a FindALUT.cmake module which is very similar to other equivalents (eg, FindOpenAL.cmake from the official distribution). The include path is being detected as '/Library/Frameworks/ALUT.framework/Headers', which is why the include isn't being transformed to a framework search path - 'cmSystemTools::IsPathToFramework' is only considering paths which /end/ in .framework.
My guess is this all worked before because XCode automatically searched /Library/Frameworks, hiding the issue. If I edit the project search paths in XCode manually to include /Library/Frameworks, I can compile as before.
I think my bug is in my FindALUT.cmake module, in that the detected include path ends in Headers/ - the relevant fragment is below:
========
FIND_PATH(ALUT_INCLUDE_DIR alut.h
HINTS
$ENV{ALUTDIR}
PATH_SUFFIXES include/AL include/ALUT include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/opt
)
====
If it's relevant, my FindALUT.cmake already detects ALUT.framework using FIND_LIBRARY, and finds the correct framework path. I could special case on if (APPLE) in my FindALUT module, but none of the built-in modules do anything like that - they simply use FIND_LIBRARY & FIND_PATH and apparently work. (But maybe because they're always detecting frameworks deployed inside /System?)
This is tested with both cmake 2.8.7 and 2.8.8
Regards,
James
More information about the CMake
mailing list