cmake解析错误:转义序列\o无效 [英] cmake parse error :Invalid escape sequence \o

查看:3049
本文介绍了cmake解析错误:转义序列\o无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多类似的错误警报信息,像这样的类型:

I have a lot of similar error alert info like this type:

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
    Syntax error in cmake code at

      C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

    when parsing string

      Header Files\\ogr\ogrsf_frmts

    Invalid escape sequence \o

文件C:/yumen/wxgisgdal-read-only/cmake/common.cmake是
喜欢的是:

the file "C:/yumen/wxgisgdal-read-only/cmake/common.cmake" is like is:

#add data
 macro(add_files_macro FPATH FGROUP)
     file(GLOB GDAL_AHHEADERS ${FPATH}/*.h  ${FPATH}/*.hpp)
     set(GDAL_HHEADERS ${GDAL_HHEADERS} ${GDAL_AHHEADERS})
     source_group("Header Files\\${FGROUP}" FILES ${GDAL_AHHEADERS})
     file(GLOB GDAL_ACSOURCES ${FPATH}/*.cpp ${FPATH}/*.cc ${FPATH}/*.c)
     set(GDAL_CSOURCES ${GDAL_CSOURCES} ${GDAL_ACSOURCES})
     source_group("Source Files\\${FGROUP}" FILES ${GDAL_ACSOURCES})
 endmacro()


$ b b

下面是cmake错误信息

below is cmake error info

gdal version=[1.9.0]
 GDAL lib name ... wxgisgdal19
 c++ compiler ... cl
 CMake Error at CMakeLists.txt:92 (option):
   option called with incorrect number of arguments: BUILD_RELEASE_DEBUG_DIRS
   Set OFF to build each co# uninstall target

   configure_file(

        C:/yumen/wxgisgdal-read-only/cmake_uninstall.cmake.in 
        C:/yumen/wxgisgdal-read-only/build/cmake_uninstall.cmake 
       IMMEDIATE @ONLY)nfiguration to a separate directory ON 


 Found GEOS: C:/geos-3.2.3/lib/geosd.lib
 Found Proj: C:/PROJ/lib/proj.lib
 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:121 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:121 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\generic

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:122 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\generic

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:122 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\mem

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:125 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\mem

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:125 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\vrt

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:130 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\vrt

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:130 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\csv

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:135 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\csv

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:135 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\dxf

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:140 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\dxf

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:140 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\shp

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:145 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\shp

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:145 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Found PostgreSQL: C:/pgsql/lib
 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\pg

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:158 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\pg

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:158 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\gml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:163 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\gml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:163 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\mitab

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:168 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\mitab

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:168 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Found LIBKML: C:\Users\Public\libkml-read-only\msvc\Debug
 Found LIBKML Headers: C:/Users/Public/libkml-read-only/src
 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\libkml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:184 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\libkml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:184 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\kml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:187 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\kml

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:187 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\geojson

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:193 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\geojson

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:193 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:5 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:5

   when parsing string

     Header Files\\ogr\ogrsf_frmts\geojson\jsonc

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:195 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 CMake Warning (dev) at cmake/common.cmake:8 (source_group):
   Syntax error in cmake code at

     C:/yumen/wxgisgdal-read-only/cmake/common.cmake:8

   when parsing string

     Source Files\\ogr\ogrsf_frmts\geojson\jsonc

   Invalid escape sequence \o

   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):
   cmake/ogr.cmake:195 (add_files_macro)
   CMakeLists.txt:135 (include)
 This warning is for project developers.  Use -Wno-dev to suppress it.

 Found JPEG: C:/GnuWin32/lib/jpeg.lib 
 Configuring incomplete, errors occurred!

一个家伙告诉我,我应该添加这样的:

a guy told me that I should add something like this:

在头文件中\ogr \ogrsf_frmts需要添加终止符'\'像这样头文件\ogr\ogrsf_frmts

In Header Files\ogr\ogrsf_frmts need to add terminator '\' like this "Header Files\ogr\ogrsf_frmts"

但我粘贴common.cmake文件内容第5行:

but as I paste the common.cmake file content line 5:

source_group(Header Files \ $ {FGROUP}FILES $ {GDAL_AHHEADERS})

source_group("Header Files\${FGROUP}" FILES ${GDAL_AHHEADERS})

字符串在头文件被FGROUP宏替换后,可以由cmake自动生成,我不能编辑它们。

string after Header Files is replaced by FGROUP macro, may generated automatically by cmake, i can not edit them.

推荐答案

发生错误是因为变量 $ {FGROUP} 的内容包含具有Windows样式分隔符的路径。这些都是由CMake作为转义字符。

The error is happening because the contents of the variable ${FGROUP} contain paths with Windows-style separators. These are treated by CMake as escape characters.

您应该更改 macro function 。从宏的文档:

You should change your macro to a function to avoid this. From the docs for macro:


请注意,宏的参数和值例如 ARGN 不是通常的CMake意义上的变量。它们是字符串替换,非常类似于c预处理器将使用宏。如果你想要真正的CMake变量,你应该看看 function 命令。

Note that the parameters to a macro and values such as ARGN are not variables in the usual CMake sense. They are string replacements much like the c preprocessor would do with a macro. If you want true CMake variables you should look at the function command.

这篇关于cmake解析错误:转义序列\o无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆