<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I'm trying to create a relocatable package configuration file but I'm having a hard time with absolute paths that are used during the build.</div><div class="">Note that I use CMake 3.10.0.</div><div class=""><br class=""></div><div class="">First of all for the include path I'm using this:</div><div class=""><div class=""><font face="Menlo" class="">target_include_directories(MyStaticTarget PUBLIC</font></div><div class=""><font face="Menlo" class="">                           $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include></font></div><div class=""><font face="Menlo" class="">                           $<INSTALL_INTERFACE:include>)</font></div></div><div class=""><br class=""></div><div class="">This does work but according to the doc it should not : <a href="https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html?highlight=build_interface#output-expressions" class="">https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html?highlight=build_interface#output-expressions</a></div><div class="">The doc of BUILD_INTERFACE says: "Content of ... when the property is exported using export(), or when the target is <u class="">used by another target in the same buildsystem</u>. Expands to the empty string otherwise."</div><div class="">So according to the doc, when compiling the target MyTarget, the include dir I gave should not be used. Which seems consistent with the other uses of INTERFACE wording in CMake language. But it actually behaves like PUBLIC rather than INTERFACE. This is fine to me but inconsistent… :)</div><div class="">When exporting the target, the include dir uses what's given in for INSTALL_INTERFACE so it works fine. No problem on that part.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The second point is about libraries to link when using my project. My project exports a <u class="">static</u> library that depends on other libraries. These libraries are found (when generating my project through cmake) through calls like find_package(OpenGL). This provides a variable that contains an absolute non-relocatable path.</div><div class=""><br class=""></div><div class="">I've tried doing things like this:</div><div class=""><font face="Menlo" class="">target_link_libraries(MyStaticTarget PRIVATE<br class="">                      $<BUILD_INTERFACE:${OpenGL_absolute_path}><br class="">                      $<INSTALL_INTERFACE:${OpenGL_relocatable_link_flag}>)</font></div><div class=""><br class=""></div><div class="">According to <a href="https://cmake.org/pipermail/cmake/2016-May/063400.html" class="">https://cmake.org/pipermail/cmake/2016-May/063400.html</a>, for static libraries, PRIVATE link dependencies become "PUBLIC", which is ok. And I could see that the link flag for this "private" dependency got exported in the generated config. But the problem is that whatever I put for INSTALL_INTERFACE, it is ignored and not written to the generated cmake config file. The generated CMake config file just takes into account what I put for BUILD_INTERFACE. Contrary to what happened with include directories. And I don't want to use only <span style="font-family: Menlo;" class="">${OpenGL_relocatable_link_flag}</span> because MyStaticTarget can be configured to be a dynamic library, in which case the library is really used during link and really want to link against the exact library that's referenced.</div><div class=""><br class=""></div><div class="">How can I have <span style="font-family: Menlo;" class="">${OpenGL_relocatable_link_flag}</span> be used in the generated cmake config file?</div><div class="">Any other solution that would make the generated config relocatable is also fine.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Lucas </div></body></html>