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

Full fix for broken yaml detection #1881

Closed

Conversation

SlawekNowy
Copy link
Contributor

Fixes #1858

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 6, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Signed-off-by: SlawekNowy <[email protected]>
Copy link
Collaborator

@remia remia left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @SlawekNowy !

share/cmake/modules/Findyaml-cpp.cmake Show resolved Hide resolved
Copy link
Contributor

@tobim tobim left a comment

Choose a reason for hiding this comment

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

With this patch I get:

CMake Error in tests/cpu/CMakeLists.txt:
  Imported target "yaml-cpp" includes non-existent path
    "yaml-cpp_INCLUDE_DIR-NOTFOUND"
  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
  * The path was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully.
  * The installation package was faulty and references files it does not
  provide.

CMake Error in src/OpenColorIO/CMakeLists.txt:
  Imported target "yaml-cpp" includes non-existent path
    "yaml-cpp_INCLUDE_DIR-NOTFOUND"
  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
  * The path was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully.
  * The installation package was faulty and references files it does not
  provide.

A better approach would be to switch to yaml-cpp::yaml-cpp in the code and create a backwards compatibility alias in case that target does not exist:

if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
  add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()

Afaics the get_target_property lines can be dropped.

@SlawekNowy
Copy link
Contributor Author

A better approach would be to switch to yaml-cpp::yaml-cpp in the code and create a backwards compatibility alias in case that target does not exist:

if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
  add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()

Do we really need to break root CMakeLists? Though the bug is still concerning.

@tobim
Copy link
Contributor

tobim commented Oct 16, 2023

Do we really need to break root CMakeLists?

I don't understand what you mean by break? Do you want me to submit another PR?

@SlawekNowy
Copy link
Contributor Author

I meant that "Does this change break anything using this file?"

@SlawekNowy
Copy link
Contributor Author

@tobim also what system do you use?

@SlawekNowy
Copy link
Contributor Author

Ok from beginning. The minimum requirement for yaml-cpp is 0.7.0. Its installed cmake module exports that lib as yaml-cpp. In 0.8.0 this is changed to yaml-cpp::yaml-cpp prompting this very PR. I am afraid that your (@tobim) patch instead of mine would fail builds both on 0.7 and 0.8 version of yaml.

@SlawekNowy SlawekNowy requested a review from remia October 28, 2023 10:14
@SlawekNowy
Copy link
Contributor Author

SlawekNowy commented Oct 28, 2023

A better approach would be to switch to yaml-cpp::yaml-cpp in the code and create a backwards compatibility alias in case that target does not exist:

if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
  add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()

Do we really need to break root CMakeLists? Though the bug is still concerning.

That code is already present in the affected file, and yet in some setups it still isn't sufficient.

@remia
Copy link
Collaborator

remia commented Oct 29, 2023

Sorry for adding yet another version but wouldn't it be simpler to make the alias target right after the initial find_package, similar to what we already do for Findexpat.cmake? Did a quick test here, only tested on macOS with 0.8.0 though.

@SlawekNowy
Copy link
Contributor Author

I theorize that was what @tobim was trying to say, and I agree @remia. Confirmed working on Linux host with yaml-cpp 0.8.0 and Linux chroot with yaml-cpp 0.7.0

@tobim
Copy link
Contributor

tobim commented Nov 2, 2023

Indeed, and that is already implemented in #1891, among some other cleanups.

@remia
Copy link
Collaborator

remia commented Nov 4, 2023

@SlawekNowy Is this PR now superseded by #1891 ? Do you think we should close this one?

@SlawekNowy
Copy link
Contributor Author

Indeed. Closing in favor of #1891.

@SlawekNowy SlawekNowy closed this Nov 4, 2023
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.

Broken yaml 0.8.0 detection.
3 participants