Full fix for broken yaml detection #1881
Conversation
Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
remia
left a comment
There was a problem hiding this comment.
Thanks for the PR @SlawekNowy !
tobim
left a comment
There was a problem hiding this comment.
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.
Do we really need to break root CMakeLists? Though the bug is still concerning. |
I don't understand what you mean by break? Do you want me to submit another PR? |
|
I meant that "Does this change break anything using this file?" |
|
@tobim also what system do you use? |
Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
|
Ok from beginning. The minimum requirement for yaml-cpp is 0.7.0. Its installed cmake module exports that lib as |
Signed-off-by: SlawekNowy <38943477+SlawekNowy@users.noreply.github.com>
That code is already present in the affected file, and yet in some setups it still isn't sufficient. |
|
Sorry for adding yet another version but wouldn't it be simpler to make the alias target right after the initial |
|
Indeed, and that is already implemented in #1891, among some other cleanups. |
|
@SlawekNowy Is this PR now superseded by #1891 ? Do you think we should close this one? |
|
Indeed. Closing in favor of #1891. |
Fixes #1858