[CMake] make install builds more than it needs to

David Cole david.cole at kitware.com
Tue Jun 19 15:54:42 EDT 2012


'make install' under the hood, by default, simply runs:

  cmake -P cmake_install.cmake

You could add your own custom target (which would NOT depend on 'all') to
execute the same command, or simply execute the raw command yourself.

To do it with a custom target, you could do:

  add_custom_target(my_install
    ${CMAKE_COMMAND} -P cmake_install.cmake
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

If you needed to ensure installed things were up-to-date first, you could
depend on them explicitly with add_dependencies. Otherwise, 'make
my_install' will simply do the install step without making sure anything
else is up to date first.


HTH,
David


On Tue, Jun 19, 2012 at 3:42 PM, Leif Walsh <leif.walsh at gmail.com> wrote:

> How can I make it not do that?
>
> Sent from my iPhone
>
> On Jun 19, 2012, at 15:39, David Cole <david.cole at kitware.com> wrote:
>
> 'make install' for a CMake-generated makefile is typically equivalent to
> 'make all && make install'
>
> 'install' depends on 'all' and all typically includes things that are
> installed and not installed.
>
>
> On Tue, Jun 19, 2012 at 3:11 PM, Leif Walsh <leif.walsh at gmail.com> wrote:
>
>> Why does `make install` build things that aren't installed?  I would
>> imagine it would only build targets that are mentioned in INSTALL().
>>
>> --
>> Cheers,
>> Leif
>> --
>>
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120619/b3a6244b/attachment-0001.htm>


More information about the CMake mailing list