<div dir="ltr">You can manage different paths (one for build export and one for install export) by using '$<BUILD_INTERFACE:...>' and '$<INSTALL_INTERFACE:...>'.<div>'$<BUILD_INTERFACE:...>' accepts absolute paths and '$<INSTALL_INTERFACE:...> expects paths relative to the install prefix (CMAKE_INSTALL_PREFIX variable).</div><div>.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Le lun. 25 juin 2018 à 16:23, Rich T <<a href="mailto:rsjtaylor.github@gmail.com">rsjtaylor.github@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi everyone, I've a question about interface sources.<br></div><div><br></div><div>If you create an interface target A, add some sources via <br></div><div><br></div><div>add_library(A INTERFACE)<br></div><div>target_sources(A INTERFACE some/relative/path)</div><div><br></div><div>then link to another library B:</div><div><br></div><div>add_library(B)<br></div><div>target_link_libraries(B PRIVATE A)</div><div><br></div><div>B will search for those sources relative to its own source directory, not the directory where A is defined. This means B fails to configure with a missing sources error if the targets are in different directories.<br></div><div><br></div><div>If I specify the paths absolutely, B successfully finds the sources. However, A can no longer be exported and neither can the static variant of B by association.<br></div><div><br></div><div>I tried using $<TARGET_PROPERTY:A,SOURCE_DIR> in front of the relative path, however it turns out SOURCE_DIR isn't a whitelisted property for INTERFACE libraries.</div><div><br></div><div>Is this behavior intentional, and if so, is there any workaround? (other than defining all targets with interface sources in the same directory as the targets that use them)</div></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>