CMake variable names case sensitive?

usr1234567 picture usr1234567 · Jan 26, 2016 · Viewed 8.2k times · Source

How does CMake treat variable names? Are they case sensitive?

If I use FindFoo.cmake with

find_package(Foo)

can I use FOO_FOUND, Foo_FOUND and foo_FOUND?

Answer

Antonio picture Antonio · Jan 27, 2016

CMake variables are case sensitive. See documentation.


As a side note, commands are case insensitive, and their arguments are case sensitive. See wiki. Keywords like STATUS are case sensitive because they are arguments. Example:

message(STATUS foo)
MESSAGE(status foo)

outputs:

foo
statusfoo

the second marked as a warning (default message type).

Still regarding case sensitivity, take also a look to the boolean variable section.