10

I am trying to generate an Xcode project from a cmake folder, using this very good answer. When executing this command:

cmake -G Xcode <dir of CMakeLists.txt>

I get:

CMake Error in CMakeLists.txt:
  The custom command generating

    /Users/fofo/Developer/ClientProject/desktop/always_build

  is attached to multiple targets:

    rake-all
    stage

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".


CMake Generate step failed.  Build files cannot be regenerated correctly.

Can I somehow specify to cmake -G Xcode <dir of CMakeLists.txt> to use the old Xcode build system, or can I somehow solve the problem changing the cmake files?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Alfonso Tesauro
  • 1,730
  • 13
  • 21

2 Answers2

17

I have found the answer here. It is possible to use the legacy build system using:

cmake -G Xcode -T buildsystem=1 .
Cœur
  • 37,241
  • 25
  • 195
  • 267
Alfonso Tesauro
  • 1,730
  • 13
  • 21
  • 2
    Xcode 14 drops support for the old build system, so this solution will stop working as Xcode 14 is adopted. – neuralmer Sep 15 '22 at 18:40
0

This fix still works in XCode 14.3.1 so I'm not sure when they'll drop support for the old build system...