<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also, you should install to &#39;lib${LIB_SUFFIX}&#39;, not &#39;lib&#39;. This will allow you (and distros packaging your software) to set LIB_SUFFIX to separate arch-specific components of 32- and 64-bit builds. E.g. on Linux, lib_suffix is usually &#39;&#39;/&#39;64&#39; or &#39;32&#39;/&#39;&#39;, and on Windows might be &#39;&#39;/&#39;/amd64&#39;.</blockquote>
<div><br></div><div><br></div><div style>if you&#39;re mentioning ${LIB_SUFFIX} you might as well mention ${LIB_PREFIX} which is the &#39;lib&#39; prepended on gnuish systems.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That is only part of the problem. Now in RepoB, I want to import the<br>
libraries. CMake documentation here:<br>
<a href="http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake/Tutorials/Exporting_and_<u></u>Importing_Targets</a><br>
<br>
states that I can do something like this:<br>
include(${PATH_OF_REPO_A_<u></u>BUILD}/repoA-targets.cmake)<br>
</blockquote>
<br></div>
You can, but I wouldn&#39;t recommend it. Instead, you should create a &#39;repoAConfig.cmake&#39; that is installed by repoA, which does this for you. Then use repoA with &#39;find_package(repoA)&#39;.<br>
<br>
Usually I generate (with @ONLY) a FooConfig.cmake and FooConfig-install.cmake with each containing an appropriate Foo_INCLUDE_DIRS. The first, intended for using your package from the build directory, will set its include directories to locations in your source and/or build. The second usually uses @CMAKE_INSTALL_PREFIX@/<u></u>include, and is installed with the RENAME option to rename it &#39;back&#39; to FooConfig.cmake.<br>

<br>
Besides setting the INCLUDE_DIRS, it should include the line:<br>
<br>
include(&quot;${CMAKE_CURRENT_LIST_<u></u>DIR}/FooTargets.cmake&quot;)<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
target_link_libraries(<u></u>repoBExecutable myLib)<br>
</blockquote>
<br>
...and then you can do this.<br>
<br>
Some things to check if it is not working:<br>
<br>
- Open repoATargets.cmake and verify that it is declaring an imported &#39;myLib&#39; target.<br>
- if(NOT TARGET myLib)<br>
    message(SEND_ERROR &quot;myLib not a target?!&quot;)<br>
  endif()<br>
<br>
It may also be beneficial to look at an existing CMake project...<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Matthew</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</div></div></blockquote></div><br></div></div>