[CMake] Can multiple make commands be set in BUILD_COMMAND for ExternalProject_Add?

David Cole david.cole at kitware.com
Wed Jul 4 10:37:46 EDT 2012


On Wed, Jul 4, 2012 at 3:35 AM, Michael Wild <themiwi at gmail.com> wrote:
> On 07/04/2012 08:37 AM, hce wrote:
>> Hi,
>>
>> In ExternalProject_Add, "BUILD_COMMAND make" works fine, but I need to add
>> multiple make commands. In Linux command line I can type "make && make
>> extra", but how can I set following BUILD_COMMAND for multiple make
>> commands, it just not working?
>>
>> BUILD_COMMAND make && make extra
>> INSTALL_COMMAND make install && make extra-install
>>
>> Thank you.
>>
>> Kind regards,
>>
>> Jupiter
>>
>
> What's wrong with?
>
> BUILD_COMMAND make all extra
> INSTALL_COMMAND make install extra-install
>
>
> HTH
>
> Michael
> --
>
> 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


Michael' suggestion is a good one.

But ... to do the equivalent of "&&" in an ExternalProject_Add call,
simply repeat the COMMAND keyword:

Not this:

>> BUILD_COMMAND make && make extra
>> INSTALL_COMMAND make install && make extra-install

But this:

  BUILD_COMMAND make COMMAND make extra
  INSTALL_COMMAND make install COMMAND make extra-install


Also, if you're going to hard-code "make", use "$(MAKE)" instead so
that the parallel job specification given to the top-level make is
inherited by the child processes too:

  BUILD_COMMAND $(MAKE) COMMAND $(MAKE) extra
  INSTALL_COMMAND $(MAKE) install COMMAND $(MAKE) extra-install


HTH,
David


More information about the CMake mailing list