<div dir="ltr">Thanks for the solution. I will try this but perhaps you are right and I should instead go with different builds for each configuration.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 4, 2013 at 3:54 AM, J Decker <span dir="ltr"><<a href="mailto:d3ck0r@gmail.com" target="_blank">d3ck0r@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>there is a variable that can be used...</div><div><br></div><div><div>if( SUPPORTS_PARALLEL_BUILD_TYPE )</div>
<div>INSTALL( .... lib/${CMAKE_INSTALL_CONFIG_TYPE} )</div><div>would install into </div>
<div><br></div><div># used as install_mode_dest( target_names )</div><div><span style="white-space:pre-wrap">macro( install_mode_dest )</span> <div><span style="white-space:pre-wrap">        </span>install( TARGETS ${ARGV}</div>
<div><span style="white-space:pre-wrap">         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-wrap">endmacro( install_mode_dest )</span> <span style="white-space:pre-wrap"><br></span></div></div><div><br></div><div>because it'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>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's just simpler</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Wed, Apr 3, 2013 at 7:06 PM, Saad Khattak <span dir="ltr"><<a href="mailto:saadrustam@gmail.com" target="_blank">saadrustam@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>I am trying my best to understand CMake'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 'add_library()' where the library is called 'myLib' 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's properties. This does not appear to be working. CMake simply adds "myLib" to the linker instead of "${FULL_PATH_OF_MYLIB}/myLib". </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></div></div><span class="HOEnZb"><font color="#888888">--<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></font></span></blockquote></div><br></div>
</blockquote></div><br></div>