[CMake] coding style for modules
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Thu Jan 4 02:02:20 EST 2018
On 2018-01-04 05:09+0300 Dave Milter wrote:
> Hello,
>
> If there is some libfoo that I want to use in my project,
> and this libfoo has it's own CMakeLists.txt I have 3 options to deal
> with such external dependency:
>
> a) Treat it like every other external dependency and write cmake code
> like FindLibFoo.cmake to find libfoo on file system.
>
> b)Include this project as git submodule and use ExternalProject to
> invoke `cmake` and `cmake --build`
>
> c)Include this project as git submodule and use add_subdirectory(libfoo)
Or
d) Use a config-file package approach (the preferred modern
alternative to the find-file package approach used in (a)). See
<https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html>
for details concerning config-file packages. Of course, this option
assumes that external software's CMake-based build system has been
developed to the point of creating a config-file package. However, if
it has a CMake-based build system already that is just lacking such a
package, it is straightforward to implement such a package (from my
experience doing that for several different projects and also from
the above URL).
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