cmake check if Mac OS X, use APPLE or ${APPLE}
问题 I would like check whether I am in Mac OS X or not, and have the following code cmake_minimum_required (VERSION 3.0) project (test) set (FOO 1) if (${FOO} AND ${APPLE}) message ("MAC OS X") endif () It failed on non-OSX system with error message CMake Error at CMakeLists.txt:4 (if): if given arguments: "1" "AND" Unknown arguments specified If I replace ${APPLE} with APPLE , the error went away. But I am a little puzzled by this. When should we refer to a variable with ${VAR} and when should