On 2007-01-31 20:25+0100 Stefan Buschmann wrote:
So, is there a way to solve this without having to add the library path to every dependent project (which would in fact make the library abstraction useless)?
Let me try to give you a general answer that I think should apply to your specific case. If any library or application that you build with CMake has symbols in it that are resolved by an external library, then your best approach is to use the find_library command (in your top-level CMakeLists.txt file or a module included from that file) to find the complete path to that external library. Then specify that complete path to TARGET_LINK_LIBRARIES only for those targets where it is required (i.e., only for targets which specifically have symbols that need to be resolved by an external library), and CMake will do the rest for you following the linking rules for your platform of choice. For example, PLplot has a core library which in turn depends on external libraries. Those external libraries only have to be mentioned for the core library, and not for all our other applications/libraries which depend on our core library. For such hierarchical linking, cmake figures everything out for you, if you follow the rule I have specified (i.e., mention the external library only for those targets which have specific symbols that need to be resolved by that external library). BTW, to test that the resulting CMake linking is correct for all targets in the build tree or install tree, I find the ldd command (especially with the -r option) and nm commands are extremely useful for the Linux case. 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 Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
