[CMake] call already made makefile

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Oct 30 11:31:42 EDT 2010


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 --------------
_______________________________________________

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