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: Add library dependencies in Config.cmake.in when building static libs #3552

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Sep 13, 2022

This fixes builds in projects that compile OpenImageIO as static libraries and don't themselves depend on the image libraries used by OpenImageIO such as PNG, JPEG or TIFF.

When OpenImageIO is built as a static library its targets have e.g. PNG::PNG among INTERFACE_LINK_LIBRARIES. If the including project does not itself depend on PNG, the following error would be observed:

Target "<...>" links to target "PNG::PNG" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, 
or an ALIAS target is missing?

Checklist:

  • I have read the contribution guidelines.
  • If this is more extensive than a small change to existing code, I
    have previously submitted a Contributor License Agreement
    (individual, and if there is any way my
    employers might think my programming belongs to them, then also
    corporate).
  • [not needed] I have updated the documentation, if applicable.
  • [not needed] I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • My code follows the prevailing code style of this project.

@p12tic p12tic changed the title cmake: Add library dependencies in Config.cmake.in when building static cmake: Add library dependencies in Config.cmake.in when building static libs Sep 13, 2022
This fixes builds in projects that compile OpenImageIO as static
libraries and don't themselves depend on the image libraries used by
OpenImageIO such as PNG, JPEG or TIFF.

When OpenImageIO is built as a static library its targets have e.g.
PNG::PNG among INTERFACE_LINK_LIBRARIES. If the including project does
not itself depend on PNG, the following error would be observed:

Target "<...>" links to target "PNG::PNG" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
@p12tic p12tic force-pushed the cmake-fix-dependencies-for-static-libraries branch from c310fe5 to b7ced07 Compare September 13, 2022 22:04
Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

@lgritz lgritz merged commit 71a3296 into AcademySoftwareFoundation:master Sep 14, 2022
@p12tic p12tic deleted the cmake-fix-dependencies-for-static-libraries branch September 14, 2022 04:53
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Sep 14, 2022
…ic (AcademySoftwareFoundation#3552)

This fixes builds in projects that compile OpenImageIO as static
libraries and don't themselves depend on the image libraries used by
OpenImageIO such as PNG, JPEG or TIFF.

When OpenImageIO is built as a static library its targets have e.g.
PNG::PNG among INTERFACE_LINK_LIBRARIES. If the including project does
not itself depend on PNG, the following error would be observed:

Target "<...>" links to target "PNG::PNG" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Sep 18, 2022
…ic (AcademySoftwareFoundation#3552)

This fixes builds in projects that compile OpenImageIO as static
libraries and don't themselves depend on the image libraries used by
OpenImageIO such as PNG, JPEG or TIFF.

When OpenImageIO is built as a static library its targets have e.g.
PNG::PNG among INTERFACE_LINK_LIBRARIES. If the including project does
not itself depend on PNG, the following error would be observed:

Target "<...>" links to target "PNG::PNG" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Sep 23, 2022
Changes since RC1:

  - ImageCache/TextureSystem both have added a `getattributetype()`
    method, which retrieves just the type of a named attribute. AcademySoftwareFoundation#3559
    (2.4.4.0)  NOTE: THIS IS AN ABI BREAKING CHANGE
  - Python: Fix the ability to `getattribute()` of int64 and uint64
    metadata or attributes. AcademySoftwareFoundation#3555 (2.4.4.0)
  - Build: Improvements to the generated cmake config files when
    building static libraries. AcademySoftwareFoundation#3552 AcademySoftwareFoundation#3557 (2.4.4.0)
  - Support for gcc 12.1. AcademySoftwareFoundation#3480 (2.4.2.1) AcademySoftwareFoundation#3551 (2.4.4.0)
  - Support building with clang 15.0. AcademySoftwareFoundation#3563 (2.4.4.0)
  - Fix cross-compiling on Android failing due to `-latomic` check. AcademySoftwareFoundation#3560
    (2.4.4.0)
  - Fix building on iOS. AcademySoftwareFoundation#3562 (2.4.4.0)
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Sep 23, 2022
Changes since RC1:

  - ImageCache/TextureSystem both have added a `getattributetype()`
    method, which retrieves just the type of a named attribute. AcademySoftwareFoundation#3559
    (2.4.4.0)  NOTE: THIS IS AN ABI BREAKING CHANGE
  - Python: Fix the ability to `getattribute()` of int64 and uint64
    metadata or attributes. AcademySoftwareFoundation#3555 (2.4.4.0)
  - Build: Improvements to the generated cmake config files when
    building static libraries. AcademySoftwareFoundation#3552 AcademySoftwareFoundation#3557 (2.4.4.0)
  - Support for gcc 12.1. AcademySoftwareFoundation#3480 (2.4.2.1) AcademySoftwareFoundation#3551 (2.4.4.0)
  - Support building with clang 15.0. AcademySoftwareFoundation#3563 (2.4.4.0)
  - Fix cross-compiling on Android failing due to `-latomic` check. AcademySoftwareFoundation#3560
    (2.4.4.0)
  - Fix building on iOS. AcademySoftwareFoundation#3562 (2.4.4.0)

Note that we bumped the version to from 2.4.3.x 2.4.4.0 to reflect the
ABI break introduced by the last minute by the IC/TS addition of a new
virtual function. ABI will not change again for 2.4.
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.

None yet

2 participants