[CMake] call already made makefile

mina adel elecengineer_mina at yahoo.com
Thu Nov 4 14:58:52 EDT 2010


Thank you so much for your help

I have another problem, I have successfully created all the 3rd-party libraries.
I used ADD_CUSTOM_COMMAND to call the makefiles that are provided using these 
libraries.

Now, I want to combine all these libraries to one library. I will link against 
this library later.
I have searched google and cmake wiki. it seems that there is no straight 
forward way to do that.

one suggested using ar command to combine the files.

what is the vest way to merge all these libraries in one library.

Thanks
Mina





________________________________
From: Alan W. Irwin <irwin at beluga.phys.uvic.ca>
To: mina adel <elecengineer_mina at yahoo.com>
Cc: cmake at cmake.org
Sent: Sat, October 30, 2010 11:31:42 AM
Subject: Re: [CMake] call already made makefile

On 2010-10-29 20:50-0700 mina adel wrote:

> 
> Hi All
> 
> I have an open source code that I use in my project. This open source code
> already has Makefile coded for it.
> 
> I want to use cmake so that before it compile my project it first call the
> cmake of these open source code, which will compile it to .la library.
..make?
> Then using this library, it compile my code.

I assume from the context you mean make rather than cmake above.

To run make (or any command) at run-time, use the combination of
add_custom_command and add_custom_target.  Basically,
add_custom_command creates an OUTPUT file (say your library) at run
time, and add_custom_target file-depends on that file and creates a
CMake target corresponding to the custom command which you can add as
a dependency of your application target.  This insures make will be run (if
the library is not up to date) before your application is built.

Note the above is a reasonable interim measure to get you started, but
I predict that once you become more familiar with cmake you will find
that you will want to also build the library with cmake to completely
get rid of your autotools chains.  :-)

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 libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101104/576f52af/attachment-0001.htm>


More information about the CMake mailing list