[CMake] Library dependencies
Hi all, I have a project setup with the following directory structure: / CMakeLists.txt Messages/ CMakeLists.txt MessageTest/ CMakeLists.txt Build/ bin/ Debug/ Release/ The subdirectory "Messages" outputs a shared library called "Messages" in release mode and "Messages_d" in debug mode. The Messages library links statically to the Google Protocol Buffer library. The subdirectory "MessageTest" outputs an executable called "MessageTest.exe", which needs to link to the Messages library. The subdirectory "Build" is where I tell CMake to build the project. The directory "bin" where I'd like the output (not object files) files to be placed. When I tell MessageTest to link to Messages (using target_link_libraries and specifying the Messages library), the Google Protocol Buffer library is added as a dependency. This is undesired, since the library is already linked statically to the Messages library, and is not directly needed by the MessageTest executable. Also, the .lib file generated by the build does not get placed into Build/bin, which is what I would like. What is the best way to do this? Thanks as always, -- Nathan Paul ___ 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
[CMake] library dependencies
Hi all, Is there a way to extract the list of library dependencies specified by target_link_libraries for a target? I would like to be able to pass the list of libraries to an external script at build time. -- /Jesper ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Library dependencies
On Thu, Jun 25, 2009 at 09:54:11PM -0500, Nathan Paul wrote: > When I tell MessageTest to link to Messages (using target_link_libraries and > specifying the Messages library), the Google Protocol Buffer library is > added as a dependency. This is undesired, since the library is already > linked statically to the Messages library, and is not directly needed by the It's past my bedtime but I think you want to play with LINK_INTERFACE_LIBRARIES: http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:LINK_INTERFACE_LIBRARIES > MessageTest executable. Also, the .lib file generated by the build does not > get placed into Build/bin, which is what I would like. What is the best way > to do this? Look at ARCHIVE_OUTPUT_DIRECTORY. tyler ___ 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
Re: [CMake] Library dependencies
LINK_INTERFACE_LIBRARIES was exactly what I needed. Thanks! As for moving the .lib that was generated for the .dll, I've made piece with keeping that at its default output location. CMake is smarter with linking than I originally thought. On Fri, Jun 26, 2009 at 12:28 AM, Tyler Roscoe wrote: > On Thu, Jun 25, 2009 at 09:54:11PM -0500, Nathan Paul wrote: > > When I tell MessageTest to link to Messages (using target_link_libraries > and > > specifying the Messages library), the Google Protocol Buffer library is > > added as a dependency. This is undesired, since the library is already > > linked statically to the Messages library, and is not directly needed by > the > > It's past my bedtime but I think you want to play with > LINK_INTERFACE_LIBRARIES: > > > http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:LINK_INTERFACE_LIBRARIES > > > MessageTest executable. Also, the .lib file generated by the build does > not > > get placed into Build/bin, which is what I would like. What is the best > way > > to do this? > > Look at ARCHIVE_OUTPUT_DIRECTORY. > > tyler > -- Nathan Paul http://nathan.effigyband.net 262.378.1007 ___ 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
Re: [CMake] library dependencies
On 2007-07-02 14:05+0200 Jesper Eskilson wrote: Hi all, Is there a way to extract the list of library dependencies specified by target_link_libraries for a target? I would like to be able to pass the list of libraries to an external script at build time. For PLplot we deal with this problem by keeping track of the library dependencies specified to TARGET_LINK_LIBRARIES in a (list) variable. If a variable doesn't serve your needs (say if you need the information in another subdirectory), then I assume you could also set a special target property using SET_TARGET_PROPERTIES and retrieve it later using GET_TARGET_PROPERTY. Alan __ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __ Linux-powered Science __ ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] library dependencies
On Monday 02 July 2007 08:05, Jesper Eskilson wrote: > Hi all, > > Is there a way to extract the list of library dependencies specified > by target_link_libraries for a target? I would like to be able to pass > the list of libraries to an external script at build time. Does export_library_dependencies() help ? You could use it to put the information in a text file which could then be used at buildtime by other tools/scripts. Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] library dependencies
2007/7/2, Alexander Neundorf <[EMAIL PROTECTED]>: On Monday 02 July 2007 08:05, Jesper Eskilson wrote: > Hi all, > > Is there a way to extract the list of library dependencies specified > by target_link_libraries for a target? I would like to be able to pass > the list of libraries to an external script at build time. Does export_library_dependencies() help ? You could use it to put the information in a text file which could then be used at buildtime by other tools/scripts. No; export_library_dependencies does not include link dependencies for executables. I've solved it by wrapping target_link_libraries in a macro, and storing the dependencies in a variable which I can pass around as I like. -- /Jesper ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake