[cmake-developers] [CMake 0015485]: CFBundleExecutable path in a bundle should not be a relative path into bundle

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 31 12:07:57 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15485 
====================================================================== 
Reported By:                Daniel Dunbar
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15485
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-03-31 12:07 EDT
Last Modified:              2015-03-31 12:07 EDT
====================================================================== 
Summary:                    CFBundleExecutable path in a bundle should not be a
relative path into bundle
Description: 
The CFBundleExecutable path inside of a CMake generated bundle is a relative
path including the bundle name itself. This is not correct, it should simply be
the name of the bundle binary that is inside the MacOS directory:

In this example:
--
$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.2)
add_library(Bar MODULE Bar.c)
set_target_properties(Bar PROPERTIES BUNDLE true)
$ touch Bar.c
$ cmake -G Ninja .
...
$ ninja
[1/2] Building C object CMakeFiles/Bar.dir/Bar.c.o
[2/2] Linking C CFBundle shared module Bar.bundle/Contents/MacOS/Bar
$ defaults read $(pwd)/Bar.bundle/Contents/Info.plist CFBundleExecutable
Bar.bundle/Contents/MacOS/Bar
$ 
--
the last line should just print "Bar".


You can verify this is not what the platform expects by trying to load the
bundle from somewhere else:
--
$ cat load.m 
#import <Foundation/Foundation.h>

int main(int argc, char **argv) {
    @autoreleasepool {
        NSBundle *bundle = [NSBundle bundleWithPath:[[NSString alloc]
initWithUTF8String:argv[1]]];
        [bundle load];
    }
    return 0;
}
$ clang load.m -o load -framework Foundation && ./load Bar.bundle
2015-03-31 09:07:24.778 load[95727:5952049] Cannot find executable for CFBundle
0x7fc292d13ac0 </private/tmp/bar/Bar.bundle> (not loaded)
--
whereas this will load fine if the CFBundleExecutable key is just "Bar".


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-03-31 12:07 Daniel Dunbar  New Issue                                    
======================================================================



More information about the cmake-developers mailing list