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

CMake: Correctly handle generated files #403

Closed
wants to merge 1 commit into from

Conversation

glebm
Copy link
Contributor

@glebm glebm commented Dec 4, 2021

Generated files depend on other generated files, and this previously resulted in the same custom command output being a dependency of multiple other custom commands without a shared custom targets.

Adds a top-level target for each generated file and ensures that commands that depend on generated files also depend on the corresponding custom targets.

Per CMake documentation:

Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use add_custom_target to drive the command and make the other targets depend on that one).

Fixes #344
Fixes #394

@glebm glebm marked this pull request as draft December 4, 2021 11:31
Generated files depend on other generated files, and this previously
resulted in the same custom command output being a dependency of
multiple other custom commands without a shared custom targets.

Adds a top-level target for each generated file and ensures that
commands that depend on generated files also depend on the corresponding
custom targets.

Per CMake documentation:

> Do not list the output in more than one independent target
> that may build in parallel or the two instances of the rule
> may conflict (instead use add_custom_target to drive the command
> and make the other targets depend on that one).
@glebm
Copy link
Contributor Author

glebm commented Jan 7, 2022

@glennrp This merges cleanly into both the master and the libpng16 branches

@cjhowedev
Copy link

I have to use @glebm's branch because the Xcode CMake build is broken. I'm not sure how iOS builds are going to work without this, as they require Xcode. I verified that @glebm's branch is working in Xcode 13.3 with CMake 3.22.3.

@meshula
Copy link

meshula commented Jun 17, 2022

Hi there, support for the "old" xcode build system is going away, and so landing this patch would be really helpful right now.


-- Configuring done
-- Generating done
CMake Error in CMakeLists.txt:
  The custom command generating

    /private/var/tmp/usd-pxr3b/build/libpng-1.6.29/pnglibconf.out

  is attached to multiple targets:

    gensym
    genfiles
    genvers

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

@ioquatix
Copy link
Contributor

I would welcome your fix in https://github.com/libpng/libpng

starseeker added a commit to BRL-CAD/brlcad that referenced this pull request Aug 19, 2022
It looks as if there's an issue with the CMake code for PNG with modern
XCode:
PixarAnimationStudios/OpenUSD#1946
pnggroup/libpng#403

This commit makes a stab at adapting the version from
libpng/libpng#2

onto our (somewhat simplified) png build.

It looks as if libpng doesn't currently have much in the way of an
active upstream (no new releases in a number of years), so will need to
keep an eye out to see what the eventual solution is.
@ctruta
Copy link
Member

ctruta commented Sep 10, 2022

Integrated. Thank you very much for your contribution.

@ctruta ctruta closed this Sep 10, 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.

libpngconf.c is attached to multiple targets Can't build with CMake nightly for Xcode
5 participants