3.17.1 Android CMake issue

3.17.1 Android CMake issue

I’ve recently updated from 3.17 to 3.17.1 and suddenly my cmake seems to have issues with Ninja?

{"cookie":"","inReplyTo":"configure","message":"CMake Error: CMake was unable to find a build program corresponding to \"Ninja\". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.","title":"Error","type":"message"}

"CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool."

Do i have to addCMAKE_MAKE_PROGRAM myself, or is something else broken ?

I’ve replaced my old CMakeLists.txt with a new one from 3.17.1 so it should be up to date, can anyone help ?


just need to install ninja, refer to

it seems like caused by a cmake newer release feature, we didn’t finger to generate ninja in cmake scripts

[SOLVED] AndroidStudio Sync Faild

oh ok, I was already wondering why it suddenly requires Ninja, since it was using it all the time in the old engine.

1 Like

@drelaptop not sure if this is 100% related to CMake, but I think since I’ve switched over to cmake I cant debug Android anymore, Failed to set breakpoint on Android Studio?

Does the Android CMake build require any special settings for debugging?


@drelaptop is it possible that COCOS2D_DEBUG isn’t defined correctly in the cmake android build?
for me it seems like it only get defined through the Android.mk files which isnt used when cmake is active right? Just noticed that since COCOS2D_DEBUG >= 1 doesn’t work anymore for android debug builds


it was defined here, a bug is COCOS2D_DEBUG was defined in release mode, otherwise doesn’t work.

Attention, COCOS2D_DEBUG macro is target related, not global. so the external source files without this macro defined.

1 Like

Android Studio itself uses ninja instead for make to build native codes. There is ninja execution program under Cmake folder, and some developers say Android Studio can not find ninja on windows. It is the Android Studio issue, you should set environment variable yourself if you meet the issue. The ninja path in my environment is

minggos-MacBook-Pro:bin minggo$ pwd
minggos-MacBook-Pro:bin minggo$
minggos-MacBook-Pro:bin minggo$
minggos-MacBook-Pro:bin minggo$ ls ninja
1 Like
Cocos2d-x 3.17.1 and Android Studio 3.3.2

@slackmoehrle i think we need to mention it in our doc.


@zhangxm sounds good. I’ll get it added to the install and FAQ of solutions.

EDIT: https://github.com/cocos2d/cocos2d-x-docs/pull/198


I met this issue when updating Android Studio’s CMake version to And it seems it is the issue of CMake as somebody meets the same issue too. I fixed it by adding a symbol link like this:

minggos-MacBook-Pro:bin minggo$ sudo ln -s /Users/minggo/Library/Android/sdk/cmake/ /usr/local/bin/ninja

you can use try CMake 3.6


has anyone found a solution to enable automatic signing for iOS builds through cmake?


I use fastlane for my builds (Android and iOS). For the iOS build the lane will sign it correctly and match will download the provisioning profiles from Apple. It’s very easy with this setup.


Never heard about “fastlane” :thinking:
Are you talking about this: https://fastlane.tools/

1 Like

You can refer to the codes, just add

set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "")
set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer")

in CMakeLists.txt. As i tested, you just need to fill the DEVELOPMENT_TEAM.

1 Like


I’ve tried something similar with the old engine few months back but used “iOS Developer” which didn’t work and it couldn’t find my Developer TeamID . but with “iPhone Developer” it seems to work.
I’ve also updated cmake since then, so probably one of those helped :slight_smile:

I’ll do some final tests including sdkbox so I can finally mark this as solved


You should fill the DEVELOPMENT_TEAM. You can find it in keychain:

  • open KeyChain Access
  • click Certificates
  • find the certificate, which is named iPhone Developer: xxx
  • right click it, and select Get Info
  • the value of Organizational Unit is the team id

yeah I already had inserted the correct ID back then where the issue was present, anyway it seems to be working now :slight_smile:



Is it possible to crontroll Resource copying for all platfroms through cmake?
I’m not 100% sure whats possible for Android, since it also has gradle which handles some stuff.
I’m currently trying to exclude a Resources/Sound/IOS folder for example, entirely through CMake, but I guess this won’t be possible?

Currently I have to remove the folders in gradle directly in the android.applicationVariants.all section

    delete(fileTree(dir: variant.mergeAssets.outputDir, includes: ['platform/apple/**']))

I’m currently still playing around with going full cmake on my project :stuck_out_tongue:
I think nearly everything works now (all platforms, sdkbox, c++17)

I had one issue in one of the old posts: CMake GUI to generate iOS project

Where the CMake build resulted in displaying the app with an incorrect size (on my ipad), with my bad obj-c knowledge it turns out there is an option in XCode to set the app to IPhone,IPad and Universial :o

The default proj.ios_mac XCode project has this set to Universial, but the CMake project has it set to IPhone ._. , Setting it to Universial works, by adding this to the CMakeLists.txt

set_xcode_property(${APP_NAME} TARGETED_DEVICE_FAMILY “1,2”)