I am trying to understand CMake and have worked with some statements requiring me to comprehend the behavior of SET() and MESSAGE(). I worked out the following in Terminal and the results leave me puzzled:
➜ ~ cmake -P /dev/stdin
set(STATUS 5)
message(${STATUS} STATUS)
5STATUS
➜ ~ cmake -P /dev/stdin
set(STATUS 5)
message(STATUS ${STATUS})
-- 5
My questions are:
I've realized that
STATUSitself is like a variable because it by default seems to print a line of--before any string that comes after it (try executing this statementMESSSAGE( STATUS "Setting flags for GNU GCC")and you will see what I mean).STATUSjust will not work if I had put it in lower casestatusinside theMESSAGE()command. Similarly, we have theFATAL_ERRORvariable which gives us a statement likeCMake Error at /foo/bar.c:2 (MESSAGE). It seems likeSTATUSandFATAL_ERRORare variables with pre-determined values. However, I have never seen any documentation for them, yet I have seen that other variables likeCMAKE_BUILD_TYPEandCMAKE_CONFIGURATION_TYPESare documented, with their definitions being explained in books like Mastering CMake. Does anyone know where I can get a comprehensive listing and definition of all such variables likeSTATUSandFATAL_ERROR?I do not understand the behavior that I saw on Terminal. Why is it that in the first case, having
STATUSafter${STATUS}gave me the wordSTATUSitself, while in the second case, with the order being reversed,STATUSbefore${STATUS}gave its original value of--?For commands like
MESSAGE()andSET()I've read from http://www.cmake.org/Wiki/CMake/Language_Syntax that they are case insensitive. However, it this also the same for variables?
Thank you very much everyone and I will appreciate any feedback or comments to correct my misconceptions.