Sorry for the late answer, I was on vacation. 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? If it is okay 
I would write some documentation as well of course.

- Stefan


-----Original Message-----
From: Brad King [mailto:brad.k...@kitware.com] 
Sent: Montag, 31. August 2015 21:33
To: Kislinskiy, Stefan
Cc: CHEVRIER, Marc; cmake-developers@cmake.org; James Johnston
Subject: Re: [cmake-developers] generator expression for path slash conversion 
(was: ExternalProject: Use native paths as substitute for directory tokens)

On 08/31/2015 09:35 AM, Kislinskiy, Stefan wrote:
> As there is already a patch for such a genex in bug 15509 and the 
> discussion in 5939 (both linked below in Brad's reply) started 7 years 
> ago... It would be a great pity to let this issue seep away again. 
> What can I do to help fixing this finally?

Someone will need to think through and propose a specific genex that does the 
path conversion that makes sense in this context.  I think something like 
$<TO_SHELL_PATH:...> may be appropriate.

For referencing command line tools (as argv[0]) the C++ side uses code like 
this now:

 this->ConvertToOutputFormat(ccg.GetCommand(i), SHELL)

This genex should map to the same conversion internally.

-Brad

Attachment: shell_path_genex.patch
Description: shell_path_genex.patch

cmake_minimum_required(VERSION 3.3.20150917 FATAL_ERROR)

project(Test VERSION 0.0.0.0 LANGUAGES NONE)

include(ExternalProject)

ExternalProject_Add(CMakeStyle
  SOURCE_DIR ${CMAKE_BINARY_DIR}
  CONFIGURE_COMMAND echo <SOURCE_DIR>
  BUILD_COMMAND echo <BINARY_DIR>
  INSTALL_COMMAND echo <INSTALL_DIR>
)

ExternalProject_Add_Step(CMakeStyle custom
  COMMAND echo <TMP_DIR>
  DEPENDERS configure
)

ExternalProject_Add(ShellStyle
  SOURCE_DIR ${CMAKE_BINARY_DIR}
  CONFIGURE_COMMAND echo $<SHELL_PATH:<SOURCE_DIR>>
  BUILD_COMMAND echo $<SHELL_PATH:<BINARY_DIR>>
  INSTALL_COMMAND echo $<SHELL_PATH:<INSTALL_DIR>>
)

ExternalProject_Add_Step(ShellStyle custom
  COMMAND echo $<SHELL_PATH:<TMP_DIR>>
  DEPENDERS configure
)
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to