I am trying to learn CMake from http://www.cmake.org/cmake-tutorial/. I don't follow how set syntax works.
For example, from this tutorial,
set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
I could understand that here we want to assign MathFunctions to the EXTRA_LIBS variable.
But what I am confusing is why we want to have EXTRA_LIBS ${EXTRA_LIBS}.
Why not just
set (EXTRA_LIBS MathFunctions)
Moreover, I test with following code
set (VALUE_1 "value 1") # A
set (VALUE_2 ${VALUE_2} "value 2") # B
message("value 1:" ${VALUE_1})
message("value 2:" ${VALUE_2})
in this case, both # A and # B produce same format of result.
So my question is what is difference between # A and # B?
EXTRA_LIBSwill be set to its current value andMathFunctionsappended. E.g. ifEXTRA_LIBSisfoo barthenset (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)expands toset (EXTRA_LIBS foo bar MathFunctions)thus settingEXTRA_LIBStofoo bar MathFunctions.