On Monday 25 October 2010, Weiyu Yi wrote: > Hi, > > This is Weiyu, a student from University of Germany. I have used > CMake as the build system instead of autotool already for some > projects. but I am still not sure about the way how the libraries > dependencies should be handled, is there any suggestion from CMAKE > group that how the dependencies within the project are dealed with? > > I have roughly read the cmake files from KDE 4.0+ and OpenSG 2.0 beta. > The build system from OpenSG 2.0 seems too complicated for my code > where there are only less than 10 parts(directories) of source codes. > OpenSG 2.0 saves the dependencies and the information for building > into txt files in order to manage great mount of dependencies > > While the cmake files from KDE 4.0 seems too simple, or?
Thanks for the compliment ! :-) Building KDE is complex, it's nice that you consider the files simple :-) > The way I use cmake now is like that : > > --------------------------------------------------------------------------- >-------- > > 1) write some macro and functions in a separate file, and > > 2) for each separate part(directoriy) of my codes with sub-project > name "XXX", I make a FindXXX.cmake file, which will be called to > handle the dependency > > 3) CMakeLists.txt in each directory, like > > ADD_INTERNAL_DEPENDENCY( XXX ) > SETUP_LIBRARY_BUILD() > > --------------------------------------------------------------------------- >-------- > > But the way how i use the mechanism of FindXXX.cmake and FIND_PACKAGE( > XXX ) is not the suggested way from the CMake group > > because the library hasn't been created while cmake is processing. so > FIND_LIBRARY() doesn't work, I use find_path() or direct assignment > instead > > Is it a good way how to deal with dependencies with CMAKE? CMake handles the dependencies automatically, you don't have to do anything special additionally. Just go into subdirs using add_subdirectory(), create the libraries there using add_library(myLibrary ...) and then use these libraries via target_link_libraries(myExecutable ... myLibrary) Alex _______________________________________________ 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
