problems following the CMake library & cross compiling tutorial

Hi, I am tying to combine the CMake library tutorial and Cross Compiling ( with the Dart C interoperability tutorial ( Applying this to a mobile app build appears to cause some different outcomes that with a terminal app and I am struggling to understand the intend or meaning of some of the CMake steps.

(1) To install the fat 5 architectures the following command is stated:
$ cmake -S. -B_builds -GXcode

However, DCMAKE_OSX_ARCHITECTURES is in hyphens. Removing this causes an error, also when selecting only a single architecture:


  is not the same length as CMAKE_OSX_ARCHITECTURES:



-DCMAKE_OSX_DEPLOYMENT_TARGET=9.3: command not found

(2) Then, when I try to run the install command
$ cmake --build _builds --config Release --target install

I receive the error

xcodebuild: error: The project ‘primitives_library.xcodeproj’ does not contain a target named ‘install’.

What am I doing wrong?

I am using macOS 11.1 and CMake 3.19.3

Do you mean quotes? It needs to be quoted because the ; in the value of the variable is interpreted as “end this command here” by the shell otherwise.

I think this is from the CMAKE_OSX_SDK variable. That variable and CMAKE_OSX_ARCHITECTURES must be the same length and match up in order (I believe).

This is a side effect of removing the quotes.

Cc: @gjasny

Cheers, this indeed removes the related errors. My assumption was that this is avoiding the errors because the part in quotes is ignored. Good to know that this is for the semicolons.

My question on xcodebuild: error: The project ‘primitives_library.xcodeproj’ does not contain a target named ‘install’. remains

Also, shouldn’t -DCMAKE_INSTALL_PREFIX=../_install leave some file in …/_install? The folder remains empty.

I am having a few issues in this area and unfortunately it is hard to tell for me, whether it is caused by those cmake commands or by the CMakeLists.txt or elsewhere in the toolchain. With the example of Dart’s C interoperability I am also missing any .dylib file, which I was able to create with another example.

Some feedback on the CMake examples, if you don’t mind: While I can follow the steps, it is hard for me as a CMake beginner to understand what is being done and why - just as with those quotes. Also it appears that you use the same name for different things such as MathFunctions or Tutorial, which (if I understand this correctly) is once an executable and once a subdirectory. The examples themselves are very relevant, though.

Not until the install step is run. The lack of an install target probably means that there are no install() commands in the CMake code itself.