View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015485CMakeCMakepublic2015-03-31 12:072016-06-10 14:31
ReporterDaniel Dunbar 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOS XOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0015485: CFBundleExecutable path in a bundle should not be a relative path into bundle
DescriptionThe 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".

TagsNo tags attached.
Attached Filespatch file icon 0001-Show-only-bundle-name-in-Xcode.patch [^] (969 bytes) 2015-04-01 16:28 [Show Content]

 Relationships

  Notes
(0038372)
Brad King (manager)
2015-03-31 13:30

The GenerateAppleInfoPList method:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v3.2.1#l3698 [^]

uses its targetName parameter as the value for CFBundleExecutable in the Info.plist file. The value of that parameter is correct for application bundles. It may need a special case for CFBundles because the value of targetName comes from cmTarget::GetFullNameInternal:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTarget.cxx;hb=v3.2.1#l3928 [^]

which has a special case for CFBundles here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTarget.cxx;hb=v3.2.1#l4027 [^]
(0038373)
Brad King (manager)
2015-03-31 13:31

Nicolas?
(0038385)
Gregor Jasny (developer)
2015-04-01 16:28
edited on: 2015-04-01 16:29

Same for the product name visible in Xcode. Patch attached. Maybe one can find a general solution.

(0038388)
Brad King (manager)
2015-04-01 16:36

Re 0015485:0038385: I think there can be more than one slash.

Ideally some refactoring would be done to allow the proper name to be extracted anywhere it is needed.
(0042746)
Kitware Robot (administrator)
2016-06-10 14:29

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.

 Issue History
Date Modified Username Field Change
2015-03-31 12:07 Daniel Dunbar New Issue
2015-03-31 13:30 Brad King Note Added: 0038372
2015-03-31 13:31 Brad King Note Added: 0038373
2015-04-01 16:28 Gregor Jasny Note Added: 0038385
2015-04-01 16:28 Gregor Jasny File Added: 0001-Show-only-bundle-name-in-Xcode.patch
2015-04-01 16:29 Gregor Jasny Note Edited: 0038385
2015-04-01 16:36 Brad King Note Added: 0038388
2016-06-10 14:29 Kitware Robot Note Added: 0042746
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team