[CMake] call already made makefile

SK sk at metrokings.com
Thu Nov 4 21:03:59 EDT 2010


On Thu, Nov 4, 2010 at 5:41 PM, mina adel <elecengineer_mina at yahoo.com> wrote:
> 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.

If the external makefile generates a library, I think you can just
deal with the library itself and not all the objects generated by
building the library.  So, use the "output" specifier of the
add_custom_command() to give the name of the library, not all the
object files.  Be warned though, that if you change a source file
covered only by the external makefile, your project will not rebuild
properly.

> what is the easiest way to combine these libraries using cmake?

Sounds like what you want is to identify the libraries produced by the
external makefile as a first class target usable by other parts of
your build, but this is the problem!  I don't think cmake has a
succinct way to do this.  Would love to hear otherwise.


More information about the CMake mailing list