Thanks for the solution. I will try this but perhaps you are right and I should instead go with different builds for each configuration.
On Thu, Apr 4, 2013 at 3:54 AM, J Decker <[email protected]> wrote: > there is a variable that can be used... > > if( SUPPORTS_PARALLEL_BUILD_TYPE ) > INSTALL( .... lib/${CMAKE_INSTALL_CONFIG_TYPE} ) > would install into > > # used as install_mode_dest( target_names ) > macro( install_mode_dest ) > install( TARGETS ${ARGV} > RUNTIME DESTINATION bin/\${CMAKE_INSTALL_CONFIG_NAME} LIBRARY DESTINATION > bin/\${CMAKE_INSTALL_CONFIG_NAME} ARCHIVE DESTINATION > lib/\${CMAKE_INSTALL_CONFIG_NAME} ) endmacro( install_mode_dest ) > > because it's in a macro, had to escape the $ until the macro is called (or > for some point)... > > > > 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 > > > On Wed, Apr 3, 2013 at 7:06 PM, Saad Khattak <[email protected]> wrote: > >> Hi, >> >> I am trying my best to understand CMake's install and export commands so >> that separate projects are able to find libraries easily. >> >> 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: >> >> install(TARGETS myLib >> DESTINATION ${PROJECT_BINARY_DIR}/lib/ >> EXPORT repoA-targets >> ) >> >> Then in the top-level CMakeLists I added: >> >> install(EXPORT repoA-targets >> DESTINATION ${PROJECT_BINARY_DIR}/lib/ >> ) >> >> When I build my project (in Visual Studio on Windows) it dumps libraries >> from all configurations in the same folder which is: >> >> ${PROJECT_BINARY_DIR}/lib >> >> 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. >> >> That is only part of the problem. Now in RepoB, I want to import the >> libraries. CMake documentation here: >> http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets >> >> states that I can do something like this: >> include(${PATH_OF_REPO_A_BUILD}/repoA-targets.cmake) >> >> target_link_libraries(repoBExecutable myLib) >> >> 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". >> >> 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. >> >> Thank you, >> Saad >> >> >> >> >> >> -- >> >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake >> > >
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
