[CMake] Find*.cmake variable naming

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Mon Jan 14 15:49:54 EST 2008


On Jan 14, 2008 2:01 PM, Rodolfo Schulz de Lima wrote:
> Hi, I'd like to comment on the Find*.cmake variable naming procedure
> adopted by cmake. Right now I have to look at some Find*.cmake files to
> see what are the output variables they create. Some packages create a
> *_LIBRARY, others *_LIBRARIES, others *_INCLUDE_DIRS and others
> *_INCLUDE_DIR. The Modules/readme.txt procedure isn't being used for
> some packages.

<snip>

As Mike commented... I agree! I would like to see consistency among
the Find*.cmake modules.

However, keep in mind that compatibility issues make it hard to fix
sometimes. In many cases the appropriate thing to do is to follow the
Modules/readme.txt and then create a compatibility layer which assigns
the correct style names to whatever there was before.

About upcased names vs mixed case... there was a thread in which it
was mentioned (I believe Brad King, but I might be wrong) that there
was a desire to move to mixed cased names. That is, if a module is
named FindBzip2.cmake, then the variables should be prefixed with
Bzip2. If it is named FindBZIP2.cmake then they should be prefixed
with BZIP2. This was do to the fact that cmake creates a set of
variables (e.g., XXX_FIND_COMPONENTS) when entering the module that
follows the case of the module's name.

I don't know if things have changed, but I would like to see
consistency. At least, modules being added these days should conform
to the readme.txt. Having a list of "standard-compliant" modules
appended to the readme.txt might help new module writers.

--Miguel

PS - Brad, I'm copying you directly since I sort of quote you.


More information about the CMake mailing list