[CMake] Install target after building it

Matthew Woehlke matthew.woehlke at kitware.com
Mon Apr 22 19:58:45 EDT 2013


On 2013-04-22 19:46, Matthew Woehlke wrote:
> On 2013-04-22 18:12, Robert Dailey wrote:
>> I want to setup a target's header files to be copied to a separate
>> directory after that target is built. Any dependent targets will
>> reference the INSTALLED header files, so they must be copied after
>> that target is built and prior to any other targets (that depend on
>> it) that get built.
>>
>> Is there a way to do this? Right now I use INSTALL( FILES ) but this
>> isn't target-specific. Thanks.
>
> I do something similar, although I wouldn't recommend using INSTALL as
> it requires re-running CMake any time you change a header.

Actually I'm not sure why I said that... it's wrong :-).

Two problems with install are 1: requires writable install directory 
(which is not guaranteed to be the case for other users), and 2: 
requires running all other install logic. (And 3: is not target 
specific, as you noted.)

-- 
Matthew



More information about the CMake mailing list