[CMake] ExternalData on unmounted Windows shares?

Magnus Therning magnus at therning.org
Fri Nov 15 16:17:11 EST 2013


On Wed, Nov 13, 2013 at 10:26:53AM -0500, Brad King wrote:
> On 11/13/2013 03:59 AM, Magnus Therning wrote:
>> On Tue, Nov 12, 2013 at 5:09 PM, Brad King <brad.king at kitware.com> wrote:
>>> Add to ExternalData_URL_TEMPLATES the entry
>>>
>>>  file:////share.host/foo/bar/%(algo)/%(hash)
>> 
>> That still fails on the real path I have to use in the project.
>> Are there any known issues with  hidden shares (name ending in $),
>> or with paths containing spaces?
>> 
>> The path that fails contains both :(
> 
> I just tried network paths containing both spaces and a $ at the end
> or in the middle.  It works just fine for me in either variable.

I just reproduced it locally.  Here's what I did:

1. Create a local share at C:\devo\shared$\

2. Place the following in C:\devo\cmake_test\CMakeLists.txt:

    cmake_minimum_required(VERSION 2.8.12)
    project(cmake-test)

    include(ExternalData)

    set(ExternalData_LINK_CONTENT SHA256)
    set(ExternalData_URL_TEMPLATES "file:////127.0.0.1/shared$/%(algo)/%(hash)")

    ExternalData_Expand_Arguments(binfile binfilevar
            DATA{files/vc_web.exe}
            )
    ExternalData_Add_Target(binfile)

3. Run configure in the CMake GUI tool with

    Source location: C:\devo\cmake_test
    Build location: C:\devo\cmake_test\_build

4. Move the generated "SHA file" to C:\devo\shared$\SHA256\, in my
   case it became

    C:\devo\shared$\SHA26\9cf657b2a8e4a3deec1aa820dd60540d000bf1e6a5ae84920e93d698c293b2fc

5. Generate for Visual Studio 2010 (all prior attempts have been with
   2012 though so that ought to produce the same issue, but I don't
   have access to VS2012 at home)

6. Start Visual Studio with the generated solution and build 'binfile'

The result I get then is:

~~~~
------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
------ Build started: Project: binfile, Configuration: Debug Win32 ------
  Generating C:/devo/cmake_test/_build/files/vc_web.exe
  -- Fetching "file:////127.0.0.1/shared$/SHA256/9cf657b2a8e4a3deec1aa820dd60540d000bf1e6a5ae84920e93d698c293b2fc"
  CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/ExternalData.cmake:717 (message):
    Object
    SHA256=9cf657b2a8e4a3deec1aa820dd60540d000bf1e6a5ae84920e93d698c293b2fc not
    found at:
  
      file:////127.0.0.1/shared$/SHA256/9cf657b2a8e4a3deec1aa820dd60540d000bf1e6a5ae84920e93d698c293b2fc ("couldn't read a file:// file")
  Call Stack (most recent call first):
    C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/ExternalData.cmake:739 (_ExternalData_download_object)
  
  
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
~~~~

>> - It's not possible to set only ExternalData_OBJECT_STORES, one has
>>   to set ExternalData_URL_TEMPLATES too.
> 
> Back when this module was part of another project and not ported to
> CMake upstream we did not have ExternalData_OBJECT_STORES and always
> used a store in the build tree.  That is why
> ExternalData_URL_TEMPLATES is required to be set.  When the
> ExternalData_OBJECT_STORES capability was created no one thought to
> lift the ExternalData_URL_TEMPLATES requirement because the projects
> using the module all set it anyway.
> 
> It is easy enough to lift that restriction:
> 
>  ExternalData: Allow local stores without any URL templates
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8eb20eea

Excellent, I hope that's slated for the next release then :)

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

Most software today is very much like an Egyptian pyramid with
millions of bricks piled on top of each other, with no structural
integrity, but just done by brute force and thousands of slaves.
     -- Alan Kay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131115/c19bbfde/attachment.pgp>


More information about the CMake mailing list