[CMake] call already made makefile

mina adel elecengineer_mina at yahoo.com
Thu Nov 4 20:41:24 EDT 2010


Thank you for your help.

I used ADD_Custom_Command() to run the makefiles of 3rd-partylibraries.

My problem is how to combine these generated  (static)  libraries into one 
static library using cmake to be used later in my project?

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? 


Thanks
Mina




________________________________
From: SK <sk at metrokings.com>
To: Alan W. Irwin <irwin at beluga.phys.uvic.ca>
Cc: mina adel <elecengineer_mina at yahoo.com>; cmake at cmake.org
Sent: Thu, November 4, 2010 7:59:49 PM
Subject: Re: [CMake] call already made makefile

On Thu, Nov 4, 2010 at 4:29 PM, SK <sk at metrokings.com> wrote:
> On Sat, Oct 30, 2010 at 8:31 AM, Alan W. Irwin
> <irwin at beluga.phys.uvic.ca> wrote:
>> 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.
>>
>
> No, this does not work when the external command is a make process.
> The problem is that the "output" of add_custom_command() is a target
> with it's own dependencies.  The external make process must always run
> in order catch dependencies that only the external make knows about.
> The only way to make sure the make process always runs is to use
> add_custom_target(), but alas, add_custom_target does not allow us to
> specify an output.
>
> See this thread from a few days ago: add_custom_command depends on
> output from add_custom_target.
>
> As far as I know, there is no satisfactory way to do use external
> makefiles with CMake.  I'm all ears if anyone has suggestions.
>

I filed a feature request for better external makefile support by way
of output from add_custom_target()
http://cmake.org/Bug/view.php?id=11407

How about for 2.8.4?


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


More information about the CMake mailing list