diff --git a/blog/posts/0143-cmake-externalproject-module.cfg b/blog/posts/0143-cmake-externalproject-module.cfg new file mode 100644 index 0000000..e362cd8 --- /dev/null +++ b/blog/posts/0143-cmake-externalproject-module.cfg @@ -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 diff --git a/blog/posts/0143-cmake-externalproject-module.html b/blog/posts/0143-cmake-externalproject-module.html new file mode 100644 index 0000000..7a1be19 --- /dev/null +++ b/blog/posts/0143-cmake-externalproject-module.html @@ -0,0 +1,53 @@ +

Recently I've started working on a C++ project that uses the CMake build +system.[1] The first thing I was in charge of +doing was fixing the build, as one of the dependencies is the SeetaFace2 +project.[2] 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 ExternalProject +module.[3]

+ +

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.

+ +

This is where ExternalProject 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 +SeetaFace2.cmake 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.[4] 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).

+ +
    +
  1. + + "Seeta Rest" on GitGud + +
  2. +
  3. + + "SeetaFace2" on GitHub + +
  4. +
  5. + + ExternalProject CMake documentation + +
  6. +
  7. + + SeetaFace2.cmake file from Seeta Rest on GitGud. + +
  8. +