6

I've tried looking for info on how to set these (in red) using CMake but have had no luck so far:

enter image description here

1st red box issue:

First of all, even though the device seems like it's been set to 'Universal' correctly, the value isn't being interpreted correctly by Xcode. When I set it to 'Universal' manually using the dropdown, it gives a tab each for iPhone and iPad. Furthermore, I know it's not being interpreted correctly as the app does not function correctly (in my case, neither the launch image nor the app itself run full screen).

I don't think setting orientation programmatically is an option for me since I need the launch image in the correct orientation as well. So can't do something like this: How do I programmatically set device orientation in iOS7?

2nd red box issue:

I use an asset file for all my icons, so at the moment I'm having to build using CMake and then press 'Use Asset Catalog' each time. I found this but doesn't seem very useful: http://cmake.3232098.n2.nabble.com/Icon-and-Launch-image-support-for-iOS-apps-td7590970.html

Community
  • 1
  • 1
Ash
  • 2,021
  • 2
  • 26
  • 59
  • 1
    Might be helpful: You can set any xcode option via e.g. set_target_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iOS Developer") - that means if you can find the option name in your ios project (should be easy to diff) - then you can easily set it via XCODE_ATTRIBUTE_XXX. – Martin Gerhardy Sep 15 '15 at 20:31
  • @MartinGerhardy The thing is, for the orientation configuration, it's not an `XCODE_ATTRIBUTE_<...>`, it's configured in the plist file. – JBL Jun 09 '16 at 09:56
  • What if you use configure_file on a MyApp.plist.in and set the proper cmake vars that should be replaced? – Martin Gerhardy Aug 02 '16 at 09:18
  • To ensure the device family is being set to Universal correctly, you can add this cmake setting: `set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")` – bleater May 03 '18 at 22:05

2 Answers2

5

Regarding the "1st box issue", I've found that the approach taken by this demo project works really well.

https://github.com/forexample/testapp/blob/master/CMakeLists.txt

They use a templated Info.plist to inject the bundle identifier, etc, during configure. The nice part is then you can modify the orientations in the plist.in file, and then these get translated cleanly to the Info.plist once you open the project.

yano
  • 4,095
  • 3
  • 35
  • 68
1

Regarding the 2nd red box issue, i found that the attribute I needed to set was XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME

For example:

set_target_properties(${TARGET} PROPERTIES
    XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")

For Launch Images I got it to work by setting it in the plist.in file under UILaunchStoryboardName as described in yano's previous answer.