0

I have a simple CMake find module I've written, for a library of mine used by other projects. It's pretty simplistic, with its full text available here. Mainly there's one find_path() and one find_library(), and then some variables are set.

Now, I want CMake, when trying to find my package, to fall back on:

  1. git-cloning or downloading the package/library from its GitHub repository,
  2. Unpacking the archive, if it was a download
  3. Building the package, either be using the running CMake itself somehow (the package has its own CMakeLists.txt), or by running an arbitrary shell command in the directory into which the packages was downloaded/cloned

The specifics of what happens post-download are less important to me than actually having a download fall-back.

How can I / how should I make this happen?

Notes:

  • Of course if the download/git clone fails, than finding the package has failed.
  • No need to worry about specific versions at the repo, although you can if you want to.
einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • I've seen those Git integrations a lot using `ExternalProject_Add()` like [here](https://stackoverflow.com/questions/15175318/cmake-how-to-build-external-projects-and-include-their-targets). Can you please give some details why that wouldn't fit your needs? Or wouldn't just printing a hint on failure how to e.g. to integrate your library as a Git submodule sufficient? – Florian Jun 12 '18 at 19:25
  • @Florian: Ah, well, the library doesn't typically install anywhere; although - maybe that could be adapted to work for me anyway. – einpoklum Jun 12 '18 at 20:27

0 Answers0