<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Thank you for your help.<br><br>I used ADD_Custom_Command() to run the makefiles of 3rd-partylibraries.<br><br>My problem is how to combine these generated  (static)&nbsp; libraries into one static library using cmake to be used later in my project?<br><br>The problem is since I used add_custom_command to run cmake. I can not know the object files generated. And I can not use them to build a bigger library. what is the easiest way to combine these libraries using cmake? <br><br>Thanks<br>Mina<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> SK &lt;sk@metrokings.com&gt;<br><b><span
 style="font-weight: bold;">To:</span></b> Alan W. Irwin &lt;irwin@beluga.phys.uvic.ca&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> mina adel &lt;elecengineer_mina@yahoo.com&gt;; cmake@cmake.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, November 4, 2010 7:59:49 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [CMake] call already made makefile<br></font><br>On Thu, Nov 4, 2010 at 4:29 PM, SK &lt;<a ymailto="mailto:sk@metrokings.com" href="mailto:sk@metrokings.com">sk@metrokings.com</a>&gt; wrote:<br>&gt; On Sat, Oct 30, 2010 at 8:31 AM, Alan W. Irwin<br>&gt; &lt;<a ymailto="mailto:irwin@beluga.phys.uvic.ca" href="mailto:irwin@beluga.phys.uvic.ca">irwin@beluga.phys.uvic.ca</a>&gt; wrote:<br>&gt;&gt; On 2010-10-29 20:50-0700 mina adel wrote:<br>&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Hi All<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I have an open source code that I use in my project. This open source
 code<br>&gt;&gt;&gt; already has Makefile coded for it.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I want to use cmake so that before it compile my project it first call the<br>&gt;&gt;&gt; cmake of these open source code, which will compile it to .la library.<br>&gt;&gt;<br>&gt;&gt; ..make?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Then using this library, it compile my code.<br>&gt;&gt;<br>&gt;&gt; I assume from the context you mean make rather than cmake above.<br>&gt;&gt;<br>&gt;&gt; To run make (or any command) at run-time, use the combination of<br>&gt;&gt; add_custom_command and add_custom_target. &nbsp;Basically,<br>&gt;&gt; add_custom_command creates an OUTPUT file (say your library) at run<br>&gt;&gt; time, and add_custom_target file-depends on that file and creates a<br>&gt;&gt; CMake target corresponding to the custom command which you can add as<br>&gt;&gt; a dependency of your application target. &nbsp;This insures make will be run (if<br>&gt;&gt; the library
 is not up to date) before your application is built.<br>&gt;&gt;<br>&gt;<br>&gt; No, this does not work when the external command is a make process.<br>&gt; The problem is that the "output" of add_custom_command() is a target<br>&gt; with it's own dependencies. &nbsp;The external make process must always run<br>&gt; in order catch dependencies that only the external make knows about.<br>&gt; The only way to make sure the make process always runs is to use<br>&gt; add_custom_target(), but alas, add_custom_target does not allow us to<br>&gt; specify an output.<br>&gt;<br>&gt; See this thread from a few days ago: add_custom_command depends on<br>&gt; output from add_custom_target.<br>&gt;<br>&gt; As far as I know, there is no satisfactory way to do use external<br>&gt; makefiles with CMake. &nbsp;I'm all ears if anyone has suggestions.<br>&gt;<br><br>I filed a feature request for better external makefile support by way<br>of output from
 add_custom_target()<br><a href="http://cmake.org/Bug/view.php?id=11407" target="_blank">http://cmake.org/Bug/view.php?id=11407</a><br><br>How about for 2.8.4?<br></div></div>
</div><br></body></html>