Function vs. Macro in CMake

前端 未结 5 2016
执念已碎
执念已碎 2020-12-12 14:45

The official document of CMake 2.8.12 says about macro

When it is invoked, the commands recorded in the macro are first modified by rep

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 15:22

    The cmake documentation you quoted is so misleading that it's basically wrong. It should be clarified/fixed like this:

    • macro: when it is invoked, the commands recorded in the macro are first all modified before any is run by replacing formal parameters (${arg1}) with the arguments passed.

    cmake --trace-expand shows exactly what happens.

    The cmake 3.13.3 doc hasn't changed compared to 2.8.12 with respect to this.

提交回复
热议问题