CMake fails on macOS #1750
Replies: 7 comments
-
The languages should be specified in the project command. If an empty new project is created for macOS and cmake fails with that error, then yes, this should be added to the template |
Beta Was this translation helpful? Give feedback.
-
Yes, building a newly generated empty project by Axmol fails. Building Axmol itself also fails. I think I've found what triggers the issue. If I comment out lines like these: I've checked how a project using Cocos works, that doesn't specify languages in the project's CMake files. In this case Objective-C/C++ files are passed to C/C++ compiler without indicating a different language. Compiler probably detects the language by file extension in this case. So in this case CMake enables only C and C++ compiler and doesn't know that it actually compiles Objective-C/C++ files, but since compiler detects the language automatically it happens to work. Btw, the language can't be easily specified using
or
The first one looks a bit cleaner. I'll make a PR later. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what you mean, because I know for a fact that this works:
I wasn't actually implying that all languages be added to |
Beta Was this translation helpful? Give feedback.
-
Ah, ok, then I misunderstood you. :) So now we have 3 ways to fix this, which one should I do? |
Beta Was this translation helpful? Give feedback.
-
It's so strange though, because I just did a test with the following:
No cmake errors at all. Then the project is opened in Xcode 15.0.1 (Mac M1 Mini with MacOS Ventura 13.6.1), and built successfully. Nothing was changed in the Regarding which method to use, either of the following would be the preference, since they're both straightforward:
or
|
Beta Was this translation helpful? Give feedback.
-
I guess you use cmake generate command directly, and not specify the axmol build command will auto set |
Beta Was this translation helpful? Give feedback.
-
Yes, you're partially right, I'm using VSCode/ninja setup for development. Just tried it and |
Beta Was this translation helpful? Give feedback.
-
I have a weird issue where running CMake for building my project, or Axmol, or Axmol's generated project, targeting macOS fails with this error:
I have to add
enable_language(OBJCXX)
to fix the issue like this:I can't figure out if this is a real issue and
enable_language(OBJCXX)
should be added to Axmol's and project templates CMakeLists.txt files, or there's something wrong with my setup. Does anyone building for macOS had the same issue?P.S. I'm using brew's CMake version 3.28.1
Beta Was this translation helpful? Give feedback.
All reactions