William A. Hoffman wrote:
At 12:26 AM 7/17/2006, Brandon J. Van Every wrote:

  
Because last I tried, it was broken.  Precise definition of "broken" later.  I'm in the middle of a huge refactoring right now, driven by these pathing and quoting and escaped whitespace problems. 
    
If it is broken, please let me know so it won't be broken in the next patch release
of CMake when it comes out.
  

Ok, FILE(TO_NATIVE_PATH ...) is "broken" on Windows in that it doesn't enclose the resultant path in double quotes.  This is a debateable aspect of design.  Quotes get in the way of merging paths, but they are also necessary to make a path usable. 


MACRO(MAKE_WINDOWS_PATH pathname)
  # An extra \\ escape is necessary to get a \ through CMake's processing.
  STRING(REPLACE "/" "\\" ${pathname} "${${pathname}}")
  # Enclose with UNESCAPED quotes.  This means we need to escape our
  # quotes once here, i.e. with \"
  SET(${pathname} \"${${pathname}}\")
ENDMACRO(MAKE_WINDOWS_PATH)

SET(CMAKEISH_PATH "C:/Program Files/Chicken")
MESSAGE(${CMAKEISH_PATH})

SET(MY_NATIVE_PATH ${CMAKEISH_PATH})
MAKE_WINDOWS_PATH(MY_NATIVE_PATH)
MESSAGE(${MY_NATIVE_PATH})

SET(YOUR_NATIVE_PATH ${CMAKEISH_PATH})
FILE(TO_NATIVE_PATH ${CMAKEISH_PATH} YOUR_NATIVE_PATH)
MESSAGE(${YOUR_NATIVE_PATH})

MACRO(SEPARATION_TEST path)
  SET(SEPARATED_HOOEY ${${path}})
  SEPARATE_ARGUMENTS(SEPARATED_HOOEY)
  MESSAGE("${SEPARATED_HOOEY}")
ENDMACRO(SEPARATION_TEST)

SEPARATION_TEST(CMAKEISH_PATH)
SEPARATION_TEST(MY_NATIVE_PATH)
SEPARATION_TEST(YOUR_NATIVE_PATH)


Brandon J. Van [EMAIL PROTECTED] ~
$ cmake -P windowspath.cmake
C:/Program Files/Chicken
"C:\Program Files\Chicken"
C:\Program Files\Chicken
C:/Program;Files/Chicken
"C:\Program;Files\Chicken"
C:\Program;Files\Chicken




_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to