[CMake] skip install of subdirectory

Tiago Macarios tiagomacarios at gmail.com
Wed Jul 20 16:39:52 EDT 2016


Hi Alan,

Thanks a lot! Yeah I was thinking about something along those lines, but i
was wondering if there is a solution that does not involve modifying the
submodules.

On Wed, Jul 20, 2016 at 12:09 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca>
wrote:

> On 2016-07-20 11:02-0700 Tiago Macarios wrote:
>
> Hi,
>>
>> I have a project which uses git submodules to manage it's dependencies.
>> Right now we want to add a installer to it, problem we have is that some
>> of
>> the dependencies have their own "install" directives. Is there a way to
>> ignore a project install command?
>>
>> Long version case it is unclear:
>>
>> main project
>>   submodule - has a install directive
>>   myCode - actual code, links statically to submodule above
>>
>> I would like to only issue the install of myCode. is there a way to tell
>> cmake or cpack to ignore "submodule" install directives?
>>
>
> Hi Tiago:
>
> You could brute force it by surrounding each install directive in
> submodule by
>
> if(INSTALL_SUBMODULE)
> ....
> endif(INSTALL_SUBMODULE)
>
> Then add
>
> option(INSTALL_SUBMODULE, "Install submodule?" OFF)
>
> to your top-level CMakeLists.txt file.
>
> Then because of that OFF, by default users would not install
> submodule, but if users desired that install, they could specify the
> -DINSTALL_SUBMODULE=ON option on the cmake command line.  Or you could
> choose to default to ON.
>
> Note, I have characterized the above as brute force, but in fact the
> method is completely flexible, and most mature CMake projects use this
> kind of option-based method a lot.
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation for stellar interiors (freeeos.sf.net); the Time
> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
> software package (plplot.sf.net); the libLASi project
> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160720/9008d1d7/attachment-0001.html>


More information about the CMake mailing list