How to add additional plist property using CMake?

I'm trying to add an item

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

for my plist, which is automatically generated by CMake. For certain keys, there appear to be predefined ways to add an element; eg:

 set(MACOSX_BUNDLE_ICON_FILE ${ICON}) 

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

I tried to use the MACOSX_BUNDLE_INFO_PLIST target property as follows: I would like the resulting plist to be identical to the old one, except for the new property that I want, so I just copied the automatically generated plist and set that as my template. But plist uses some Xcode variables that also look like ${foo} , and CMake grumbles about it:

Syntax error in cmake code when parsing line

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

syntax error, unexpected cal_SYMBOL, Waiting} (47)

CMP0010 policy is not installed: Poor 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 if this is correct. I cannot find a good example or good documentation about this. Ideally, I would just let CMake generate everything as before, and just add one extra line. What can I do?

+6
iphone cmake plist macos
source share
2 answers

You learned to copy the corresponding *.plist.in file to /opt/local/share/cmake-2.8/Modules (e.g. MacOSXBundleInfo.plist.in ) by editing it to place <key>UIStatusBarHidden</key><true/> (or @ VAR_TO_REPLACE_BY_CMAKE@ ), and adding the modified version directory to CMAKE_MODULE_PATH ?

If you have installed CMake as an application package, then the location of this file is /Applications/CMake.app/Contents/share/cmake-NN/Modules

+6
source share

You can add your values ​​with @ and pass @ONLY to the configure file.

Unfortunately, there is no easy way to add a custom string to the generated file.

-2
source share

All Articles