On Friday 17 June 2011, Glenn Coombs wrote: > If the library you are trying to build is one that is totally under your > control then really it should be a subdirectory of your MY_APP source tree > so that you can call add_subdirectory() on it. If MY_LIB is shared across > multiple projects then you can always arrange for it to appear as a > subdirectory of MY_APP when you check the code out from your revision > control system. We do this with cvs modules but I'm sure that git and > mercurial have similar capabilities. > > If you still can't get MY_LIB to be a subdirectory of MY_APP then you might > be able to build it using add_directory with the second argument: > > add_subdirectory(${LIB_SRC} mylib)
Yes. Just some comments: You should either: * build the library and the executable within one cmake project, then cmake will take care of everything, no need for link_directories(), etc. You can just do target_link_libraries(myApp myLib) and that's it. * or build them in two completely separate projects. In this case, when you build the myApp project, the cmake code in myApp must *find* the installed myLib somewhere (using e.g. find_package() or find_library()). It definitely should not guess about where the source directory of myLib is and try to run cmake there. These are then two completely separate things. 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