MantisBT - CMake
View Issue Details
0006215CMakeCMakepublic2008-01-04 10:322016-06-10 14:30
Eric Wing 
Bill Hoffman 
normaltweakalways
closedmoved 
 
 
0006215: FIND_LIBARY not returning the proper capitalization on found frameworks/libraries (OS X)
Given a very simple CMakeLists.txt like this:

FIND_PATH(OPENAL_INCLUDE_DIR al.h)
FIND_LIBRARY(OPENAL_LIBRARY NAMES openal OpenAL)


the FIND_LIBRARY will return
/System/Library/Frameworks/openal.framework
while FIND_PATH returns
/System/Library/Frameworks/OpenAL.framework/Headers

Notice the capitalization difference. The actual directory name is OpenAL.framework so it should have upper-case letters.

At first, I thought FIND_LIBRARY was lower-casing the letters and would cause a problem with file systems that are case-sensitive.

But I now suspect that it is an artifact of searching against the list of NAMES and "openal" is before "OpenAL", and because I am on a case-insensitive filesystem, the all-lowercase version produces a match and is taken. So this actually may not be an actual problem.

However, it would probably be good to return the proper capitalization to the file anyway. This is more consistent and prevent anybody from over reacting like me.





No tags attached.
has duplicate 0008563closed Bill Hoffman CMake sometimes uses/detects wrong case in file paths 
Issue History
2008-01-04 10:32Eric WingNew Issue
2008-01-04 10:40Bill HoffmanNote Added: 0010070
2008-01-04 10:40Bill HoffmanStatusnew => assigned
2008-01-04 10:40Bill HoffmanAssigned To => Bill Hoffman
2008-01-04 13:06Sean McBrideNote Added: 0010073
2009-02-19 17:25Bill HoffmanRelationship addedhas duplicate 0008563
2011-07-29 11:38Sean McBrideNote Added: 0027116
2016-06-10 14:27Kitware RobotNote Added: 0041405
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0010070)
Bill Hoffman   
2008-01-04 10:40   
This is because FIND_LIBRARY(OPENAL_LIBRARY NAMES openal OpenAL) has both cases, if you changed the order it would find the upper case one first. On windows there is a function to get the actual case of a path. Is there some thing like this for the Mac? This will not be a problem on a different file system because it won't find the wrong case version.
(0010073)
Sean McBride   
2008-01-04 13:06   
This reminds me of bug 4572.

The following snippit seems to get us from wrong case to right case:

FSRef fsRef;
OSStatus err;
UInt8 foo[PATH_MAX];
err = FSPathMakeRef ("/sysTem/liBrary/frameWorks/", &fsRef, NULL);
err = FSRefMakePath (&fsRef, foo, sizeof(foo));

the starting path would need to exist on disk though! I'm not 100% sure if this is guaranteed to work, or if it's relying on undocumented behaviour.
(0027116)
Sean McBride   
2011-07-29 11:38   
This bug (0006215) and my bug 0008563 are dupes I think.

Instead of that FSRef stuff, I believe realpath() could be used, see 'man 3 realpath'.
(0041405)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.