Hi,

today i ran into an error with escape characters in macros. Is this a known 
issue? Is this by design? How can I workaround?

Code:
function(f STRING)
   message(STATUS ${STRING})
endfunction()

macro(m STRING)
   message(STATUS ${STRING})
endmacro()

set(CONTENT "bla bla \/\/")
message(STATUS ${CONTENT})
f(${CONTENT})
m(${CONTENT})

Output:
ramold@xxx MINGW64 /c/Program Files/CMake/cmake-3.13.4-win64-x64/bin
$ ./cmake.exe -P test.cmake
CMake Warning (dev) at test.cmake:9 (set):
  Syntax error in cmake code at

    C:/Program Files/CMake/cmake-3.13.4-win64-x64/bin/test.cmake:9

  when parsing string

    bla bla \/\/

  Invalid escape sequence \/

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- bla bla \/\/
-- bla bla \/\/
CMake Warning (dev) at test.cmake:6 (message):
  Syntax error in cmake code at

    C:/Program Files/CMake/cmake-3.13.4-win64-x64/bin/test.cmake:6

  when parsing string

    bla bla \/\/

  Invalid escape sequence \/

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  test.cmake:12 (m)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- bla bla \/\/

Regards,
Felix Ramold
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to