Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CMake compatible with Xcode's 'New build system' #359

Closed
wants to merge 1 commit into from

Conversation

ssrobins
Copy link
Contributor

As of CMake 3.19, CMake now defaults to Xcode's new build system when generating for Xcode 12.0 or higher.

If I run cmake -G Xcode -B build to generate a macOS build with Xcode, I get these configuration errors (they show one at a time, you have to fix one to see the next one):

CMake Error in CMakeLists.txt:
  The custom command generating

    /Users/steve/Code/github/libpng/build/pnglibconf.c

  is attached to multiple targets:

    genfiles
    gensym
    genvers

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".
  CMake Error in CMakeLists.txt:
  The custom command generating

    /Users/steve/Code/github/libpng/build/scripts/symbols.out

  is attached to multiple targets:

    symbol-check
    genfiles

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".
  CMake Error in CMakeLists.txt:
  The custom command generating

    /Users/steve/Code/github/libpng/build/pnglibconf.c

  is attached to multiple targets:

    genfiles
    genvers

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

I noticed that the symbol-check, genvers, and gensym targets weren't referenced anywhere else in the source tree so I removed them, which fixed the error. The genfiles target also references these files and is a dependent of png and png_static so that's the target that's actually getting used in the build.

I confirmed that this fixed the build with CMake 3.19. I also ran builds with CMake 3.18 to make sure generating to Xcode's legacy build system still works. Also made sure everything still built on Windows, Linux, iOS, and Android through my CI checks:
ssrobins/conan-libpng#3

@glebm
Copy link
Contributor

glebm commented Dec 4, 2021

I've also sent an alternative fix in #403

@ssrobins
Copy link
Contributor Author

ssrobins commented Nov 8, 2022

Problem is solved in 1.6.38 so I'm closing this. Thanks all!

@ssrobins ssrobins closed this Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants