[CMake] Examples creating exported Makefiles and correct library link order

J Decker d3ck0r at gmail.com
Tue Jun 14 22:11:43 EDT 2011


I wrote a C script that I configure_file on that writes a cmakelists
module (might also be a makefile)

(I think) The cmake way would be to define PROJECT_LIBRARIES;
PROJECT_INCLUDE_DIR; PROJECT_LIBRARY_DIR; PROJECT_INCLUDE_DIR... all
of which can be built from knowing CMAKE_INSTALL_PREFIX

but you have to recreate by hand where you installed things to to
append to the CMAKE_INSTALL_PREFIX to get the appropriate things.
Also I think you can get the current directory that the makefile is
in, so you could build makefile references from whereever it happens
to be at the time that way.

CMAKE_INSTALL_CONFIG_NAME might also be of use for distributing
debug/release libraries... ./include/Project, ./lb/Project/Debug,
./lib/Project/Release ,....



On Tue, Jun 14, 2011 at 3:56 PM, Lori Pritchett-Sheats <lpritch at lanl.gov> wrote:
> My project needs to create and install a Makefile that other client projects
> could import to link against our project. T
>
> I have a simple template file that generates an exported Makefile using the
> configure_file command, however I'm struggling with how to create a variable
> that contains all the libraries our project builds and the correct ordering
> for linking. I noticed in the CMakeCache.txt file there are variables
> {target name}_LIB_DEPS  with the dependencies listed, but I can't find any
> documentation on these variables or find a way to access all the library
> target names to even read these variables.
>
> I've looked at the Trilinos build system to see how they do this but it's
> not straightforward. Does anyone know of a smaller project that creates a
> exported Makefile that generates correct library link orders?
>
>
>
> --
> Lori A. Pritchett-Sheats, PhD.
> CCS-2, Computational Physics and Methods
> Office: 505-665-6675
> Fax: 505-665-4972
>
> Los Alamos National Laboratory
> P.O. Box 1663
> MS D413
> Los Alamos, NM 87544
>
> _______________________________________________
> 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
>


More information about the CMake mailing list