[cmake-developers] How to get install locations?

Robert Maynard robert.maynard at kitware.com
Thu Mar 23 14:33:21 EDT 2017


> One cmInstallTargetGenerator seems to install one file only and there
> seems to be one per cmGeneratorTarget. Is that correct? How does the
> installation of targets with multiple artifacts work?

Just to clarify/muddy the waters. Once
https://gitlab.kitware.com/cmake/cmake/merge_requests/574 has been
merged in cmInstallTargetGenerator will support OBJECT targets which
have multiple artifacts to install.

On Thu, Mar 23, 2017 at 1:10 PM, Brad King <brad.king at kitware.com> wrote:
> On 03/23/2017 11:37 AM, Tobias Hunger wrote:
>> cmInstallTargetGenerator has std::string GetDestination(std::string
>> const& config) const, too, which might have what I need. Unfortunately
>> that is not static, so I need to figure out how to get the right
>> instance of cmInstallTargetGenerator.
>>
>> I tried to get the cmMakefile from the localGenerator and then iterate
>> over the list of cmInstallGenerator* I got from the cmMakefile's
>> GetInstallGenerators() method. But that in empty after I am done with
>> configure. Is that expected?
>>
>> Am I on the right track with this?
>
> Yes, but there is a separate list in each cmMakefile for each source
> directory.  You'd have to traverse the entire structure to find all
> of them.
>
>> One cmInstallTargetGenerator seems to install one file only and there
>> seems to be one per cmGeneratorTarget. Is that correct? How does the
>> installation of targets with multiple artifacts work?
>
> They are created by install() command invocations.  See the impl in
> `Source/cmInstallCommand.cxx`.  For each target the artifacts are
> each given an install generator.  Then there is a block that adds
> all of them:
>
> ```
>     this->Makefile->AddInstallGenerator(archiveGenerator);
>     this->Makefile->AddInstallGenerator(libraryGenerator);
>     this->Makefile->AddInstallGenerator(runtimeGenerator);
>     ...
> ```
>
> The code model reported by your protocol needs to cover the possibility
> of more than one install(TARGETS) command for a given target.  Each
> target may be installed to zero or more destinations.  You could either
> try to put this in a list inside each target, or separately model our
> concept of installation lists that reference targets instead.
>
> -Brad
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers


More information about the cmake-developers mailing list