Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 macro() 命令进行上下文不敏感的字符串替换,但是:
cmake_minimum_required(VERSION 2.8) MACRO(TestMacro mystring) message(mystring) endmacro() TestMacro("hello world") message("hello world")
输出:
我的字符串你好世界
而不是
你好世界你好世界
正如我所料。谁能看到我做错了什么?
尝试取消引用宏参数:
MACRO(TestMacro mystring) message(${mystring}) endmacro()
另请参阅语法介绍。