Skip to content

Full fix for broken yaml detection #1881

Closed
MrSoup678 wants to merge 5 commits into
AcademySoftwareFoundation:mainfrom
MrSoup678:yaml-fix
Closed

Full fix for broken yaml detection #1881
MrSoup678 wants to merge 5 commits into
AcademySoftwareFoundation:mainfrom
MrSoup678:yaml-fix

Conversation

@MrSoup678
Copy link
Copy Markdown
Contributor

Fixes #1858

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Oct 6, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
Copy link
Copy Markdown
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 !

Comment thread share/cmake/modules/Findyaml-cpp.cmake
Copy link
Copy Markdown
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.

@MrSoup678
Copy link
Copy Markdown
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
Copy Markdown
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?

@MrSoup678
Copy link
Copy Markdown
Contributor Author

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

@MrSoup678
Copy link
Copy Markdown
Contributor Author

@tobim also what system do you use?

Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
@MrSoup678
Copy link
Copy Markdown
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.

Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
@MrSoup678 MrSoup678 requested a review from remia October 28, 2023 10:14
@MrSoup678
Copy link
Copy Markdown
Contributor Author

MrSoup678 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
Copy Markdown
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.

@MrSoup678
Copy link
Copy Markdown
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
Copy Markdown
Contributor

tobim commented Nov 2, 2023

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

@remia
Copy link
Copy Markdown
Collaborator

remia commented Nov 4, 2023

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

@MrSoup678
Copy link
Copy Markdown
Contributor Author

Indeed. Closing in favor of #1891.

@MrSoup678 MrSoup678 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