English 中文(简体)
How to add an extra plist property using CMake?
原标题:

I m trying to add the item

<key>UIStatusBarHidden</key><true/>

to my plist that s auto-generated by CMake. For certain keys, it appears there are pre-defined ways to add an item; for example:

set(MACOSX_BUNDLE_ICON_FILE ${ICON})

But I can t find a way to add an arbitrary property.

I tried using the MACOSX_BUNDLE_INFO_PLIST target property as follows: I d like the resulting plist to be identical to the old one, except with the new property I want, so I just copied the auto-generated plist and set that as my template. But the plist uses some Xcode variables, which also look like ${foo}, and CMake grumbles about this:

Syntax error in cmake code when parsing string

  <string>com.bedaire.${PRODUCT_NAME:identifier}</string>

syntax error, unexpected cal_SYMBOL, expecting } (47)

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run "cmake --help-policy CMP0010" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.

In any case, I m not even sure that this is the right thing to do. I can t find a good example or any good documentation about this. Ideally, I d just let CMake generate everything as before, and just add a single extra line. What can I do?

最佳回答

Have you looked into copying the relevant *.plist.in file in /opt/local/share/cmake-2.8/Modules (such as MacOSXBundleInfo.plist.in), editing it to put <key>UIStatusBarHidden</key><true/> (or @VAR_TO_REPLACE_BY_CMAKE@), and adding the directory of the edited version in the CMAKE_MODULE_PATH?

If you have CMake installed as an app bundle, then the location of that file is /Applications/CMake.app/Contents/share/cmake-N.N/Modules

问题回答

You can add your values using @ and pass @ONLY to configure_file.

Unfortunately there is no simple way to add custom line to generated file.





相关问题
2 mysql instances in MAC

i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL. now the seperate mysql installation is ...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

Switching J2SE versions on Mac OS (SnowLeopard)

My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5. A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows: lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签