[CMake] skip install of subdirectory
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Wed Jul 20 15:09:07 EDT 2016
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
__________________________
More information about the CMake
mailing list