[CMake] Howto create a ProjectConfig.cmake tutorial

Eric Noulard eric.noulard at gmail.com
Wed Aug 8 07:04:37 EDT 2012


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