我的cmake中有这样的内容:
set(MyLib_SRC $ENV{MyLib_DIR}/MyLib.cpp)
add_library(MyLibrary STATIC ${MyLib_SRC})
Run Code Online (Sandbox Code Playgroud)
但是当我运行cmake时,出现此错误:
CMake Warning (dev) at CMakeLists.txt:97 (add_library):
Syntax error in cmake code when parsing string
D:\New\Development\Lib/myLib.cpp
Invalid escape sequence \N
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.
Run Code Online (Sandbox Code Playgroud)
我读了这个OS答案cmake分析错误:无效的转义序列\ o,但是如何将宏(哪个宏!)更改为函数?
env变量的值为
MyLib_DIR=D:\New\Development\Lib
Run Code Online (Sandbox Code Playgroud)