Fix installing CMake exported targets#475
Conversation
b2af522 to
756c743
Compare
|
|
Superseeds #446 as it tries to support cmake <2.8 |
756c743 to
f6399c7
Compare
|
How does this PR supersede #446 if it also uses generator expressions ( |
f6399c7 to
75a2077
Compare
|
@sergiud you were right with the generator expressions. now the main change is in yaml-cpp-config.cmake.in , which in case of using a newer cmake version will propagate the include dir onto the imported target (but the yaml-cpp can still be built and deployed using cmake 2.6) |
| include_directories(${YAML_CPP_SOURCE_DIR}/include) | ||
|
|
||
|
|
||
| include_directories(include) |
There was a problem hiding this comment.
I'm not sure this is correct; include_directories is usually passed an absolute path. At best, this change is superfluous.
| @@ -267,12 +263,12 @@ endif() | |||
| set(INCLUDE_INSTALL_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/include) | |||
There was a problem hiding this comment.
This should change also.
| endif() | ||
|
|
||
| file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INCLUDE_INSTALL_ROOT_DIR}") | ||
| file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${INCLUDE_INSTALL_ROOT_DIR}") |
There was a problem hiding this comment.
This will expand to <prefix>/<prefix>/... in some cases.
|
|
||
| # Our library dependencies (contains definitions for IMPORTED targets) | ||
| include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") | ||
| if(TARGET yaml-cpp) |
There was a problem hiding this comment.
This should be set on the target, not done like this.
|
I am assuming this PR is long outdated (targeting cmake below 3.15 is definitely not on our to do list any more 😅 ) Please feel free to reopen if any future work is planed. |
Before the patch, the installed exported targets were referencing artifacts produced in the build tree, the patch fixes:
E.g.:
Previously it would fail if the build tree would be removed.