[cmake-developers] [Review Request] New module: IncludeUrl

Daniele E. Domenichelli ddomenichelli at drdanz.it
Wed Oct 7 10:15:50 EDT 2015


Hello all,

Please review the "IncludeUrl" topic[1] that adds a new "IncludeUrl"
module. This module adds the include_url command that is useful to
download and include other CMake modules from a given url.

[1]https://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/IncludeUrl


The main use case for such a module is for groups that have several
projects or CMake scripts, handled by different developers, that import
the same CMake module that is sometimes updated, and they want to keep
these files synchronized in all the projects. This is very hard to
achieve when the developers are many and don't care too much about the
build system. Instead of adding this file to each project, this module
allows to put it somewhere, and automatically download and include it
when required. This is not optimal in some cases, for example when
network is not available, when packaging a project using build machines
that may not have access to the network, or basically any case in which
file(DOWNLOAD) is not optimal, but it can be useful in several other
cases, for example for projects that are not going to be packaged any
time soon, or that already depend on the network for some reason (e.g.
ExternalProject) and for CMake scripts.

This module has 3 main operation modes:

* Normal mode: Always try to download the latest version of the file,
  but if the download fails use the last version available.
* DOWNLOAD_ONCE mode: Download the file the only first time or (if used
  in combination with EXPECTED_HASH or EXPECTED_MD5) when the hash
  mismatches.
* DOWNLOAD_ALWAYS mode: Never use a previously downloaded version of
  the file. If used with OPTIONAL can be used for a module that is not
  available all the time and should not be included in case the
  download fails.



The topic comes with a broad set of unit tests. I tested only on local
files, because I assume that the download part is already tested enough
with unit tests for the file(DOWNLOAD) command. Also for now I tested it
only on linux, therefore I expect some failure on other platforms...

Thanks.



Regards,
 Daniele


More information about the cmake-developers mailing list