Popular languages such as C, C++, python, ksh are always case-sensitive for both variables and functions. So, I'm surprised to learn that CMake treats that differently. What's the reason? Thank you.
CMake variables are case-sensitive, as in other popular languages. However, the CMake commands are case-insensitive for historical reasons, and due to CMake's strict adherence to backwards-compatibility. A quote from CMake maintainer, Brad King:
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case.
indicates that CMake commands used to be upper-case. However, the convention now is to use lower-case commands.
Many behaviors and conventions from older versions of CMake have been maintained (and aged-out) using CMake policies. The cmake_policy command gives developers control over whether the old or new behavior should be used. However, as far as I know, there is no policy dictating case-sensitivity for CMake commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With