New blog post on CMake's ExternalProject module.
This commit is contained in:
parent
6472059860
commit
d64605aef0
5
blog/posts/0143-cmake-externalproject-module.cfg
Normal file
5
blog/posts/0143-cmake-externalproject-module.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
filename = 2021-08-28-cmake-externalproject-module.html
|
||||
title = The CMake ExternalProject Module
|
||||
description = When working recently on a C++ project using the CMake build system, I've learned to use a fairly useful module called ExternalProject which allows you to download source and combile it within the build of the project.
|
||||
created = 2021-08-28
|
||||
updated = 2021-08-28
|
53
blog/posts/0143-cmake-externalproject-module.html
Normal file
53
blog/posts/0143-cmake-externalproject-module.html
Normal file
@ -0,0 +1,53 @@
|
||||
<p>Recently I've started working on a C++ project that uses the CMake build
|
||||
system.<sup><a href="#r1" >[1]</a></sup> The first thing I was in charge of
|
||||
doing was fixing the build, as one of the dependencies is the SeetaFace2
|
||||
project.<sup><a href="#r2" >[2]</a></sup> Originally you had to have the
|
||||
SeetaFace2 project in a directory adjacent to the SeetaRest project directory,
|
||||
and you would manually compile SeetaFace2. This, for obvious reasons, is not a
|
||||
good build setup. So my task was to integrate it directly into the build using
|
||||
CMake's <code>ExternalProject</code>
|
||||
module.<sup><a href="#r3" >[3]</a></sup></p>
|
||||
|
||||
<p>Generally, for those of us used to the way things work on Linux, generally
|
||||
speaking you want to work solely with the dependencies you can install from your
|
||||
distribution's repositories. The problem with this is, save for certain very
|
||||
popular libraries/tools, there are some inconsistencies as to what packages may
|
||||
be available in different distributions, what versions they have available, or
|
||||
even if it's compiled with the flags you need for your project. It's still ideal
|
||||
to link to something from the repositories, but it's not always possible.</p>
|
||||
|
||||
<p>This is where <code>ExternalProject</code> comes in. This allows for
|
||||
dependencies to be downloaded and compiled with specific options that best suite
|
||||
the project. It's also done in a rather simple manner. Just by looking at the
|
||||
<code>SeetaFace2.cmake</code> module for the project, it's fairly easy for
|
||||
anyone with a basic knowledge of CMake syntax to see how this project is built
|
||||
and setup.<sup><a href="#r4" >[4]</a></sup> And since you're having to build an
|
||||
entire other project, it's also helpful that you have the option of choosing
|
||||
which targets to build (instead of the entire project).</p>
|
||||
|
||||
<ol class="refs" >
|
||||
<li id="r1" >
|
||||
<a href="https://gitgud.io/bug-zapper-software/seeta_rest"
|
||||
target="_blank" >
|
||||
"Seeta Rest" on GitGud
|
||||
</a>
|
||||
</li>
|
||||
<li id="r2" >
|
||||
<a href="https://github.com/seetafaceengine/SeetaFace2/"
|
||||
target="_blank" >
|
||||
"SeetaFace2" on GitHub
|
||||
</a>
|
||||
</li>
|
||||
<li id="r3" >
|
||||
<a href="https://cmake.org/cmake/help/latest/module/ExternalProject.html"
|
||||
target="_blank" >
|
||||
ExternalProject CMake documentation
|
||||
</a>
|
||||
</li>
|
||||
<li id="r4" >
|
||||
<a href="https://gitgud.io/bug-zapper-software/seeta_rest/-/blob/master/CMake/SeetaFace2.cmake"
|
||||
target="_blank" >
|
||||
<code>SeetaFace2.cmake</code> file from Seeta Rest on GitGud.
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
Loading…
Reference in New Issue
Block a user