[CMake] Howto create a ProjectConfig.cmake tutorial

Nico Schlömer nico.schloemer at gmail.com
Wed Aug 8 10:59:01 EDT 2012


> see:
> cmake --help-module CMakePackageConfigHelpers

This gives

$ cmake --help-module CMakePackageConfigHelpers
cmake version 2.8.7
Argument "CMakePackageConfigHelpers" to --help-module is not a CMake module.

on my system.
I understand now that ${INSTALL_DATA_DIR} is a variable I'll just have
to set myself, which does work if I set to a directory relative to the
installation directory.

Even the example runs through cleanly then, and produces

FooBarLibraryDepends.cmake
FooBarLibraryDepends-release.cmake

The all-important FooBarConfig.cmake, which I though this whole
document was about, is not created.
Is there any other documentation on this?

--Nico



On Wed, Aug 8, 2012 at 1:04 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2012/8/8 Nico Schlömer <nico.schloemer at gmail.com>:
>> Hi,
>>
>> I just looked at
>> http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
>> to learn about exporting build information to the installation, and
>> started off by copying-and-pasting the contents of the tutorial to my
>> own project. It doesn't quite run through since there's this one
>> undefined variable ${INSTALL_DATA_DIR}. I have no idea what this is
>> actually supposed to be.
>
> Usually this is the install prefix location of the "data" of your project.
> Like some dictionaries, or template files for something, may be CMake script
> files as well or ....
>
> You can have a look  at GNUInstallDirs.cmake module to chekcout various
> "standard" directories.
>
> cmake --help-module GNUInstallDirs
>
>
>> Anyone?
>
> The example is buggy, if you take the FooBar.zip "as-is" it can be configured
> but trying to install gives you:
>
> -- Install configuration: ""
> CMake Error at cmake_install.cmake:56 (FILE):
>   file cannot create directory: /FooBar/CMake.  Maybe need administrative
>   privileges.
>
> telling you that "INSTALL_DATA_DIR" has not been defined in the project.
> I guess you get similar error?
>
> Concerning ProjectConfig file you should have a look at the helper module:
> CMakePackageConfigHelpers.cmake
>
> see:
> cmake --help-module CMakePackageConfigHelpers
>
> it provides macros which "helps" to produce package config files.
>
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org


More information about the CMake mailing list