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 errors when used as sub-project via add_subdirectory() #555

Closed
mmp opened this issue Sep 12, 2019 · 3 comments
Closed

cmake errors when used as sub-project via add_subdirectory() #555

mmp opened this issue Sep 12, 2019 · 3 comments
Assignees
Milestone

Comments

@mmp
Copy link
Contributor

mmp commented Sep 12, 2019

If I try using the beta as a sub-project in a bigger system, via ADD_SUBDIRECTORY(src/ext/openexr) in my top-level CMakeLists.txt file, I get the errors below. (I don't see these if I just build OpenEXR as is.)

- Configure ILMBASE Version: 2.4.0 Lib API: 24.0.0
CMake Error at src/ext/openexr/IlmBase/config/CMakeLists.txt:28 (set_target_properties):
  Attempt to promote imported target "Threads::Threads" to global scope (by
  setting IMPORTED_GLOBAL) which is not built in this directory.


-- Configure OpenEXR Version: 2.4.0 Lib API: 24.0.0
CMake Error at src/ext/openexr/OpenEXR/config/CMakeLists.txt:53 (set_target_properties):
  Attempt to promote imported target "ZLIB::ZLIB" to global scope (by setting
  IMPORTED_GLOBAL) which is not built in this directory.
@mmp
Copy link
Contributor Author

mmp commented Sep 12, 2019

...and while removing those lines fixes use as a subproject, it leads to a bunch of warnings like this if I try to build openexr standalone...

CMake Error at OpenEXR/exrenvmap/CMakeLists.txt:4 (add_executable):
  Target "exrenvmap" links to target "ZLIB::ZLIB" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

mmp added a commit to mmp/openexr that referenced this issue Sep 12, 2019
@kdt3rd kdt3rd added the CMake label Sep 13, 2019
@kdt3rd kdt3rd self-assigned this Sep 13, 2019
@kdt3rd kdt3rd mentioned this issue Sep 14, 2019
@kdt3rd
Copy link
Contributor

kdt3rd commented Sep 14, 2019

Matt - I've put in a PR that fixes this for me. I created a dummy a.out project and was able to use add_subdirectory to cleanly pull in OpenEXR. Not sure what O.S. / version you are running under, but I've minimally tested under ubuntu 18.04, CentOS 7.6 (with epel to pull in cmake3), Arch Linux.

Don't forget, you may want to disable PyIlmBase and the OpenEXR_Viewers if you aren't using them to save build time (although they should just warn and not error if you don't have all the prereqs).

@kdt3rd
Copy link
Contributor

kdt3rd commented Sep 15, 2019

Merged, confirmed as fixed

@kdt3rd kdt3rd closed this as completed Sep 15, 2019
@cary-ilm cary-ilm added this to the v2.5.0 milestone Apr 27, 2020
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

No branches or pull requests

3 participants