[cmake-developers] generator expression for path slash conversion

Kislinskiy, Stefan s.kislinskiy at Dkfz-Heidelberg.de
Thu Sep 24 11:08:34 EDT 2015


Great, thank you, Brad & David.

Regarding the ExternalProjectShellPathGenex test: I wrongly assumed that the WIN32 variable wouldn't be set when using MSYS and the like. Would it make sense to keep the test when changing the WIN32 check to MSVC? Good to know that pushd is working for quoted paths. As I didn't use paths with spaces, the argument wasn't quoted and the test worked like expected for me (succeeded with the SHELL_PATH genex and failed when I removed the SHELL_PATH genex). We could ensure that there isn't any space character in the argument by using a top-level path like C:/. Not hard coded but derived from a variable like CMAKE_SOURCE_DIR. Or, of course, there is a standard Windows command out there that cannot handle slashed even if they are quoted (any idea?). I chose pushd, as that was the command that started it all (used indirectly by the Boost build scripts).

Regarding the nice bracket tweak: Maybe the minimum required version in Tests/GeneratorExpression/CMakeLists.txt should be updated to 3.0.0 then?

Stefan

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Donnerstag, 24. September 2015 16:22
To: Kislinskiy, Stefan
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] generator expression for path slash conversion

On 09/24/2015 09:05 AM, Kislinskiy, Stefan wrote:
> I factored out the code from 
> cmOutputConverter::ConvertToOutputFormat()
> into another helper method called 
> ConvertDirectorySeparatorsForShell(),
> changed the SHELL_PATH genex to accept only absolute paths, and 
> changed its documentation accordingly. I also added a BadSHELL_PATH 
> test to the RunCMake/GeneratorExpression tests, that use the 
> SHELL_PATH genex with an empty parameter as well as a relative path. I 
> also fixed the TEST/CTEST typo you discovered yesterday.

Thanks.  I started with a change to simplify the test infrastructure slightly:

 Tests: Simplify GeneratorExpression check implementation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7de868c4

Then I applied your changes with minor tweaks and merged to 'next'
for testing:

 Genex: Add a SHELL_PATH expression
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8adf6ab5

I left out the ExternalProjectShellPathGenex test because it fails on the Ninja, MSYS Makefiles, and MinGW Makefiles generators on Windows.  The 'pushd' and 'popd' commands do not work there due to the way the build tool runs the command in a shell.  It passed for me only in a VS IDE generator.  See also David Cole's sibling response about this test.

-Brad



More information about the cmake-developers mailing list