[CMake] Cmake 2.8.2 Bug under windows

J Decker d3ck0r at gmail.com
Fri Aug 13 18:03:00 EDT 2010


Yes, this patch fixes the problem thank you.

On Fri, Aug 13, 2010 at 1:39 PM, Brad King <brad.king at kitware.com> wrote:
> On 8/12/2010 8:36 PM, J Decker wrote:
>> CMake Error: The source directory "C:/build/test" does not exist.
>> Specify --help for usage, or press the help button on the CMake GUI.
>> Makefile:118: *** [cmake_check_build_system] Error 1
>
> I found it.  CMake actually is preserving the path as "/test" until
> the make tool re-runs it with the "-H\test" option.  Then the same
> code path that causes just "cmake ... \test" to fail gets hit.  The
> code assumed that paths with a single leading slash were always
> UNIX-style paths with forward slashes.
>
> Please try the patch below against v2.8.2 on your real test case.
> It works for me with the toy case you posted.  I don't know how
> this would have worked for you with earlier CMake versions.  This
> code has not changed in a long time.
>
> -Brad
>
> P.S.  I don't know what I was smokin' earlier when I claimed that
> "/test" is not valid.  CMake uses forward slashes for all its paths
> internally even on Windows, and I also know it's okay to use an
> implied current drive letter.  My bad.
>
>
> diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
> index 3153235..1f3b5af 100644
> --- a/Source/kwsys/SystemTools.cxx
> +++ b/Source/kwsys/SystemTools.cxx
> @@ -3143,9 +3143,9 @@ const char* SystemTools::SplitPathRootComponent(const char* p,
>        }
>      c += 2;
>      }
> -  else if(c[0] == '/')
> +  else if(c[0] == '/' || c[0] == '\\')
>      {
> -    // Unix path.
> +    // Unix path (or Windows path w/out drive letter).
>      if(root)
>        {
>        *root = "/";
>
>


More information about the CMake mailing list