Are CMake variable variable names case sensitive?

How does CMake handle 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 ?

+5
source share
3 answers

CMake variables are case sensitive. See the documentation .


As a side note, the parties are case insensitive and their arguments are case sensitive. See the wiki . Keywords such as STATUS are case sensitive because they are arguments. Example:

 message(STATUS foo) MESSAGE(status foo) 

outputs:

 foo statusfoo 

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

Still considering case sensitivity, see also the boolean variable section.

+7
source

They case sensitive.

Here is an example:

 set(foo 42) MESSAGE( STATUS ${foo}) MESSAGE( STATUS ${Foo}) 

Output:

 -- 42 -- 
+3
source

See the FindFoo documentation for the correct _FOUND variable. Or it is possible to use this tool someday:

https://youtu.be/BPgXuvPAl-8?t=659

+1
source

Source: https://habr.com/ru/post/1241550/


All Articles