CMake Error at cocos2d/cmake/Modules/CocosConfigDepend.cmake:94 (endmacro): Flow control statements are not properly nested

3.3k views Asked by At

Hey I'm a newbie cocos 2d x developer, I'm just trying to get a "Hello World" project created in XCode for iOS. From the terminal I'm using the command

cmake ../.. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos

I keep getting these two errors and the xcode project file does not generate.

CMake Error at cocos2d/cmake/Modules/CocosConfigDepend.cmake:94 (endmacro):
  Flow control statements are not properly nested.
Call Stack (most recent call first):
  cocos2d/cmake/Modules/CocosBuildSet.cmake:43 (include)
  CMakeLists.txt:42 (include)

What am I doing wrong?

see attached screenshot [1]: https://i.stack.imgur.com/cIiNC.jpg

System Specs:

MacOS Big Sur 11.4 (Virtual Machine via VMware)
cocos2d-x-4.0
cocos Console 2.3
Xcode 12.5.1
Python 2.7.16
cmake 3.21.0
1

There are 1 answers

0
Chris On

CMake 3.14+ Xcode 10+ Visual Studio 2019 Android Studio 3.4+,NDK r19c+

Need https://github.com/leetal/ios-cmake

Try this

enter code here
$mkdir build_ios
$cd build_ios
$cmake .. -GXcode -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DENABLE_ARC=FALSE
$open test.xcodeproj

The default is iOS device project, and platform parameters such as os.toolchain.cmake support -DPLATFORM=SIMULATOR64 need to be added when adjusting to simulator. Please refer to its documentation