cmake分析错误:转义序列无效\o
我有很多类似的错误警报信息,例如:cmake分析错误:转义序列无效\o,cmake,Cmake,我有很多类似的错误警报信息,例如: 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 escap
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只读/cmake/common.cmake
为
就像是:
#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()
以下是CMake错误信息:
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!
一个家伙告诉我,我应该添加这样的内容:
在头文件\\ogr\ogrsf\u frmts
中,需要添加终止符'\'
,如下所示:
"Header Files\\ogr\\ogrsf_frmts"
但是当我粘贴common.cmake
文件内容行5时:
source_group("Header Files\\${FGROUP}" FILES ${GDAL_AHHEADERS})
头文件后的字符串替换为
FGROUP
宏,可能由CMake自动生成,因此我无法编辑它们。发生错误,因为变量${FGROUP}
的内容包含带有Windows样式分隔符的路径。CMake将这些字符视为转义字符
您应该将设置更改为a以避免出现这种情况。从宏的文档中
:
请注意,宏的参数和值(如ARGN
)不是通常的CMake意义上的变量。它们是字符串替换,就像c预处理器对宏所做的那样。如果需要真正的CMake变量,应查看函数
命令
使用函数真的会有帮助吗?
add_files_macro
的第二个参数显然包含一个未经转换的反斜杠;CMake将以任何方式将其解释为转义序列。否-错误消息显示正在正确调用宏,因为引用的行位于宏体内部(在source\u组
call的第5行)。如果字符串包含一个未转换的反斜杠,则错误将详细说明调用宏的点,而不是宏本身。更改为函数将解决此问题,因为它会以不同的方式处理其参数。好的,感谢您的澄清。我不知道函数和宏之间的这种特殊区别。嗯,你停止学习的那一天就是你死亡的那一天。你的意思是我将common.cmake文件内容更改为:#添加数据函数(添加文件)宏FPATH FGROUP文件(GLOB GDAL_AHHEADERS${FPATH}/*.h${FPATH}/*.h${FPATH}/*.hpp)集(GDAL_HHEADERS${GDAL_HHEADERS}${GDAL_AHHEADERS})源组(头文件\\${GDAL${FGROUP})文件(GLOB GDAL_ACSOURCES${FPATH}/*.cpp${FPATH}/*.cc${FPATH}/*.c)set(GDAL_CSOURCES${GDAL_CSOURCES}${GDAL_ACSOURCES})source组(“source Files\\\${FGROUP}”Files${GDAL_ACSOURCES})endfunction()