<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 'lib${LIB_SUFFIX}', not 'lib'. 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 ''/'64' or '32'/'', and on Windows might be ''/'/amd64'.</blockquote>
<div><br></div><div><br></div><div style>if you're mentioning ${LIB_SUFFIX} you might as well mention ${LIB_PREFIX} which is the 'lib' 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't recommend it. Instead, you should create a 'repoAConfig.cmake' that is installed by repoA, which does this for you. Then use repoA with 'find_package(repoA)'.<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 'back' to FooConfig.cmake.<br>
<br>
Besides setting the INCLUDE_DIRS, it should include the line:<br>
<br>
include("${CMAKE_CURRENT_LIST_<u></u>DIR}/FooTargets.cmake")<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 'myLib' target.<br>
- if(NOT TARGET myLib)<br>
message(SEND_ERROR "myLib not a target?!")<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>