[CMake] override variable in macro

Bill Hoffman bill.hoffman at kitware.com
Fri Sep 21 14:58:27 EDT 2007


Juan Sanchez wrote:
> Ok,
>
> But cpp doesn't discriminate between ${BAR} and BAR.
> #include <iostream>
> using namespace std;
> #define foo(x) x = 3; cout << x << "\n";
>
> int main()
> {
>   int y = 1;
>   foo(y);
>   cout << y << endl;
> }
>   
I said like cpp, not exactly cpp.   The difference is you have to use ${} to
expand and argument not just its name.  Anyway, I don't think
it will get changed because it would break backward compatibility
way too much.

-Bill



More information about the CMake mailing list