<div dir="ltr"><div style>there is a variable that can be used...</div><div style><br></div><div style><div>if( SUPPORTS_PARALLEL_BUILD_TYPE )</div><div>INSTALL( ....  lib/${CMAKE_INSTALL_CONFIG_TYPE} )</div><div style>would install into </div>
<div><br></div><div style># used as install_mode_dest( target_names )</div><div><span style="white-space:pre">macro( install_mode_dest )</span> <div><span class="" style="white-space:pre">        </span>install( TARGETS ${ARGV}</div>
<div><span style="white-space:pre">                RUNTIME DESTINATION bin/\${CMAKE_INSTALL_CONFIG_NAME}
                LIBRARY DESTINATION bin/\${CMAKE_INSTALL_CONFIG_NAME}
                ARCHIVE DESTINATION lib/\${CMAKE_INSTALL_CONFIG_NAME} )
</span><span style="white-space:pre">endmacro( install_mode_dest )</span> <span style="white-space:pre"><br></span></div></div><div><br></div><div style>because it&#39;s in a macro, had to escape the $ until the macro is called (or for some point)...</div>
<div><br></div></div><div><br></div><div><br></div><div style>but; from an automaton standpoint, might consider just buildling one mode at a time, and using a different build for other mdoes...   .../build/vs10/debug/   ../build/vs10/release/   sorta... and just target bin lib  etc. it&#39;s just simpler</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 3, 2013 at 7:06 PM, Saad Khattak <span dir="ltr">&lt;<a href="mailto:saadrustam@gmail.com" target="_blank">saadrustam@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying my best to understand CMake&#39;s install and export commands so that separate projects are able to find libraries easily. </div>
<div><br></div><div>I am having a tremendously hard time understand what CMake is doing. After &#39;add_library()&#39; where the library is called &#39;myLib&#39; I called the following:</div>


<div><br></div><div>install(TARGETS myLib</div><div>    DESTINATION ${PROJECT_BINARY_DIR}/lib/</div><div>    EXPORT repoA-targets</div><div>    )</div><div><br></div><div>Then in the top-level CMakeLists I added:</div>
<div><br></div><div>install(EXPORT repoA-targets</div><div>    DESTINATION ${PROJECT_BINARY_DIR}/lib/</div><div>    )</div><div><br></div><div>When I build my project (in Visual Studio on Windows) it dumps libraries from all configurations in the same folder which is: </div>


<div><br></div><div>${PROJECT_BINARY_DIR}/lib </div><div><br></div><div>and over-writes the previous library file from a different configuration because they are named the same. At the same time, it actually generates a repoA-targets-debug.cmake file, but points to the now over-written library file which is of a different configuration. Why would CMake do this? Makes no sense.</div>


<div><br></div><div>That is only part of the problem. Now in RepoB, I want to import the libraries. CMake documentation here: <a href="http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets" target="_blank">http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets</a></div>


<div><br></div><div>states that I can do something like this: </div><div>include(${PATH_OF_REPO_A_BUILD}/repoA-targets.cmake)</div><div><br></div><div>target_link_libraries(repoBExecutable myLib)</div>

<div><br></div><div>and CMake should be able to find myLib and correctly add it to the linker&#39;s properties. This does not appear to be working. CMake simply adds &quot;myLib&quot; to the linker instead of &quot;${FULL_PATH_OF_MYLIB}/myLib&quot;. </div>


<div><br></div><div>I hope that somebody can explain what I am doing wrong and how to install and export libraries properly with CMake and then successfully import and use them in another project.</div><div>

<br></div><div>Thank you,</div><div>Saad</div><div><br></div><div><br></div><div><br></div><div><br></div></div>
<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/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/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/listinfo/cmake</a><br></blockquote></div><br></div>