Hendrik Sattler wrote: > Zitat von Mats Kindahl <m...@sun.com>: >>>> Ideally, I would like to copy or build the libraries in a central >>>> "lib/" >>>> directory similar to how I copy all the include files to the "include/" >>>> directory, but how is that supported by CMake? >>> >>> See >>> http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:CMAKE_LIBRARY_OUTPUT_DIRECTORY >>> >>> >>> >>> Or you use the INSTALL() directives to add the install target that you >>> can use to install the files into a wanted directory structure. >> >> Well... in this case, the libraries are only temporary and used >> during the build of the final target. > > So they are static libs? Then that doesn't matter.
Yes, they are static. Dynamic libraries will also have to be handled, but that is different problem. >>>> So, basically, each package can depend on a number of include files and >>>> libraries that have not yet been built, so somehow I need to specify >>>> rules for how to build it all in a good order. >>> >>> Using target_link_libraries() already does this _if_ you defined the >>> library with add_library() _before_ using target_link_libraries. You >>> GLOB will apply alphabetic order. Don't use it if you need a specific >>> order. Use an explicit list instead. >> >> Well... in this case, I don't know the subdirectories that will be >> used, nor the dependencies. > > So you want to build something that you have no information about? Kind of, yes. :) Once a concrete system is being build, the information is there, it is just not known beforehand what it will be. In other words, CMake has enough information to set up the system for building when it executes. >> Only the subsystems know what dependencies they have on other items, so >> therefore I would like to place the dependencies inside the packages, >> and the >> dependencies are on specific library files and header that are made >> available >> for other packages. >> >> I was somehow hoping that CMake would resolve the dependencies, as >> long as they are provided, and create a proper build order for all the >> subsystems (assuming, of course, that the dependencies form a DAG). > > But the add_library() and add_executable() calls but be in proper order > to do so. The rest in done with target_link_library(). > > The problem is that target_link_library() takes both, library target > names, full path to library files or base names of installed libraries. > The first two are linked with full path, the latter is used with e.g. -lio. > Having 'io' as target is not enforced :-/ > This implies the proper order of the add_*() calls. > > You can do that with variables (like done with C/C++ header guards) and > reference the libraries CMakeLists.txt files before using the targets > declared there. Ah, this is what I'm trying to do... how do I reference the CMakeLists.txt files as separate dependencies? In the documentation, it says that "add_dependency" just can refer to top-level targets introduced using add_library, add_executable, or add_custom_target. Unfortunately, add_custom_target does not create, e.g., a file that can be used to ensure that the target is not re-build if it has not changed. Best wishes, Mats Kindahl -- Mats Kindahl Senior Software Engineer Database Technology Group Sun Microsystems _______________________________________________ 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