[Cmake] Upper case for package names

Brad King brad.king at kitware.com
Fri Apr 25 09:54:30 EDT 2003


> > There is no easy way right now to upper-case a string from cmake listfile
> > code, but this has been added to the list of features for the next
> > version.  If you are willing to invest the time, it is possible to write a
> > dynamically loaded command in C code that does anything you want.
>
> Sounds interesting, but... doesn't this command needs to be compiled,
> somehow, before using it. So, can it be part of my source tree and be
> compiled automatically by CMake before it's used in the same build?

Yes, that is correct.  CMake will build the command into a shared library
and load it immediately before reading the rest of your cmake code. See
the CMake source code in the "CMake/Tests/LoadCommand" directory for an
example of how to do this.

> I want to set them. I'm trying to setup a build framework which is a
> little bit more complicated.  My CMake project consists of several
> "packages" which can be either compiled as part of the project or used
> from a prebuilt source. I want to use the FIND_PACKAGE mechanism to
> setup the proper INCLUDE_DIRs and LINK_DIRs (so the package can be used
> stand-alone, too). As in my main CMakeList, I already know where to look
> for the <pkg>Config.cmake file, I wanted to preset the _DIR cache entry
> automatically.

That is a good plan.  If the packages are all in your project anyway, why
can't you just hard-code the upper-case versions of the names?

-Brad




More information about the CMake mailing list