Discussion:
[CMake] CMake and Sandboxed Mac OS X app
NoRulez
13 years ago
Permalink
Hello @everyone,



I want to use cmake and „make“ from the command line (without Xcode) to
build an Mac OS X app which make use of the “new” sandboxing feature.



I added the following lines, but in the activity monitor the app is still
not sandboxed:

IF(APPLE)

SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)

SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
PROPERTIES GENERATED TRUE)

SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
PROPERTIES OBJECT_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.entitlements)


SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.enti
tlements PROPERTIES GENERATED TRUE)

.

.

.

ENDIF(APPLE)



Did I miss something?



Any help would be great.



Thanks in advance



Best Regards

NoRulez
David Cole
13 years ago
Permalink
I have not heard of anybody building a Sandboxed app using CMake yet.

What are the requirements for a Sandboxed app? Is there a
documentation page from Apple that describes what needs to be in the
Info.plist to support Sandboxing?


Thx,
David


On Tue, Nov 22, 2011 at 10:44 AM, NoRulez <***@me.com> wrote:
> Hello @everyone,
>
>
>
> I want to use cmake and „make“ from the command line (without Xcode) to
> build an Mac OS X app which make use of the “new” sandboxing feature.
>
>
>
> I added the following lines, but in the activity monitor the app is still
> not sandboxed:
>
> IF(APPLE)
>
>     SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
> PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
>
>     SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
> PROPERTIES GENERATED TRUE)
>
>     SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
> PROPERTIES OBJECT_DEPENDS
> ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.entitlements)
>
>
> SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.entitlements
> PROPERTIES GENERATED TRUE)
>
>     .
>
>     .
>
>     .
>
> ENDIF(APPLE)
>
>
>
> Did I miss something?
>
>
>
> Any help would be great.
>
>
>
> Thanks in advance
>
>
>
> Best Regards
>
> NoRulez
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
Sean McBride
13 years ago
Permalink
On Tue, 22 Nov 2011 11:45:29 -0500, David Cole said:

>What are the requirements for a Sandboxed app? Is there a
>documentation page from Apple that describes what needs to be in the
>Info.plist to support Sandboxing?

The main doc is here:
<http://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html>

It's more than just adding keys in Info.plist, the app also needs to be codesigned, which is typically done by invoking the 'codesign' tool (see man codesign).

--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
NoRulez
13 years ago
Permalink
Hi Sean,

did you know if I also need special compiler and/or linker flags?

Best Regards

-----Ursprüngliche Nachricht-----
Von: Sean McBride [mailto:***@rogue-research.com]
Gesendet: Dienstag, 22. November 2011 17:56
An: David Cole; NoRulez
Cc: CMake MailingList
Betreff: Re: [CMake] CMake and Sandboxed Mac OS X app

On Tue, 22 Nov 2011 11:45:29 -0500, David Cole said:

>What are the requirements for a Sandboxed app? Is there a documentation
>page from Apple that describes what needs to be in the Info.plist to
>support Sandboxing?

The main doc is here:
<http://developer.apple.com/library/mac/#documentation/Security/Conceptual/A
ppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html>

It's more than just adding keys in Info.plist, the app also needs to be
codesigned, which is typically done by invoking the 'codesign' tool (see man
codesign).

--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
Sean McBride
13 years ago
Permalink
On Tue, 22 Nov 2011 18:35:42 +0100, NoRulez said:

>did you know if I also need special compiler and/or linker flags?

That's more of an Xcode question than a CMake question... IIRC, no you don't. You just need to add your entitlements file and codesign. But it's been a few months since I played with App Sandbox. It's still half-baked and I gave up on it.

--
____________________________________________________________
Sean McBride, B. Eng ***@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
NoRulez
13 years ago
Permalink
> IIRC, no you don't

Thanks



This means that I only have to add the following parameters to my codesign
call: "--entitlements MyEntitlements.plist"

Is this correct? Because I already tried this but then if I launch my app
the application crashes.



The file MyEntitlements.plist contains:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>com.apple.security.app-sandbox</key>

<true/>

</dict>

</plist>



-----Ursprüngliche Nachricht-----
Von: Sean McBride [mailto:***@rogue-research.com]
Gesendet: Dienstag, 22. November 2011 18:38
An: NoRulez; 'David Cole'
Cc: 'CMake MailingList'
Betreff: Re: AW: [CMake] CMake and Sandboxed Mac OS X app



On Tue, 22 Nov 2011 18:35:42 +0100, NoRulez said:



>did you know if I also need special compiler and/or linker flags?



That's more of an Xcode question than a CMake question... IIRC, no you
don't. You just need to add your entitlements file and codesign. But it's
been a few months since I played with App Sandbox. It's still half-baked
and I gave up on it.



--

____________________________________________________________

Sean McBride, B. Eng <mailto:***@rogue-research.com>
***@rogue-research.com

Rogue Research <http://www.rogue-research.com>
www.rogue-research.com

Mac Software Developer Montréal, Québec, Canada
Loading...