[cmake-developers] [CMake] Integrating ExternalData with Artifactory

Brad King brad.king at kitware.com
Mon Sep 22 10:07:38 EDT 2014


On 09/19/2014 06:07 PM, Taylor Braun-Jones wrote:
> On Fri, Sep 19, 2014 at 3:04 PM, Brad King wrote:
>> I think it can be activated by a special format of an entry in
>> ExternalData_URL_TEMPLATES that specifies a lookup key that maps
>> to some kind of custom configuration of a .cmake script to include
>> or command to launch with execute_process.
> 
> How about defining new URL scheme like:
> 
> externaldatacommand://<*file|module*>/<*command*>

Yes, something along these lines is what I had in mind.

> list(APPEND ExternalData_URL_TEMPLATES
>   "externaldatacommand://ArtifactoryExternalData/ARTIFACTORY_DOWNLOAD_FILE?ALGO=%(algo)&"
> )
> 
> And inside Testing/CMake/ArtifactoryExternalData.cmake it would look like:
> 
> function(ARTIFACTORY_DOWNLOAD_FILE file algo hash)

Since CMake does not support variable evaluation in a command name,
this would require configuring a file with code in it to launch for
each entry of this form in the url templates list.

Also CMAKE_MODULE_PATH will not be available to the ExternalData
module when it is launched at build time to do the download.  The
include() will have to work with a full path, perhaps stored in
the configured copy of "ExternalData_config.cmake.in".  It could
be indexed with a key.  Perhaps:

  list(APPEND ExternalData_URL_TEMPLATES
    "ExternalDataCustomScript://MyFetch/%(algo)/%(hash)"
    )
  set(ExternalData_CUSTOM_SCRIPT_MyFetch /path/to/MyFetch.cmake)

The script would be include()-ed in place of the current call
to _ExternalData_download_file with the part of the URL after
the "MyFetch/" already parsed into some variable(s).

-Brad




More information about the cmake-developers mailing list