[cmake-developers] generator expression for path slash conversion

Kislinskiy, Stefan s.kislinskiy at Dkfz-Heidelberg.de
Mon Sep 21 10:05:27 EDT 2015


I wrote the documentation and extended the GeneratorExpression tests for the SHELL_PATH genex. It works fine for WIN32 and UNIX. However, I'm having some trouble to test for MSYS. The check looks like:

if(MSYS)
  check(test_shell_path "/c/shell/path")
elseif(WIN32)
  check(test_shell_path "c:\\\\shell\\\\path")
elseif(UNIX)
  check(test_shell_path "c:/shell/path")
endif()

No matter what I'm doing, it always ends up in the WIN32 branch with FORWARD slashes. Additionally the drive letter is NOT converted to a posix path as it should be the case for MSYS. I tried MSYS from the official MinGW package, and I tried the MSYS2 installer. In both cases I called cmake from MinGW-sh, MSYS-sh, and even cmd.exe. I used the "MSYS Makefiles" Generator. In addition I tried the "MinGW Makefiles" generator just to check if "if(MINGW)" is working... which also fails. The configuring/generating itself is working.. Any ideas?

Stefan

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Donnerstag, 17. September 2015 15:56
To: Kislinskiy, Stefan
Cc: CHEVRIER, Marc; cmake-developers at cmake.org; James Johnston
Subject: Re: [cmake-developers] generator expression for path slash conversion

On 09/17/2015 09:51 AM, Kislinskiy, Stefan wrote:
> I wrote a SHELL_PATH genex which uses
> cmOutputConverter->ConvertToOutputFormat(..., SHELL) for the conversion.
> I decided to name the genex SHELL_PATH instead of TO_SHELL_PATH for 
> the sake of consistency to other genexes like LOWER_CASE. What do you think?

LGTM.

> I would write some documentation as well of course.

Yes, please.  Also please look at extending the test suite to cover it.
See Tests/GeneratorExpression for genex unit test examples.  If possible we should also have a case that uses it in practice in a way that fails on invocation of an actual native tool if the slashes are wrong.  That will confirm not only that the genex does what we expect but that it also solves the problem we're trying to solve.

Thanks,
-Brad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: shell_path_genex_v2.patch
Type: application/octet-stream
Size: 5640 bytes
Desc: shell_path_genex_v2.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150921/2a8e135d/attachment.obj>


More information about the cmake-developers mailing list