I’d like to override the cmake cached variable using the command line. But if a variable is repeatedly provided, does the last value take effect?
# what is the value of FOO?
> cmake -DFOO=123 -DFOO=321
Update:
Test result shows that the last value takes effect. However, I couldn’t find any documentation describing such behavior. Is this behavior consistent across different OS? Should I write script based on this assumption?
Yes, the last takes place from my test as well. However, this behavior is not documented anywhere. I’m wondering if I can write script based on this assumption.
Given CMake’s backwards compatibility guarantees, it is likely something we’d need to guarantee in the future. Please open an issue for us to make sure it is in the documentation.