[CMake] What is recommended to export a package definition ?

Fabien Spindler Fabien.Spindler at inria.fr
Sun Oct 12 13:24:13 EDT 2014


Hi,

I want to create a config file for my package so that it can be found 
using find_package()

In the config file, I have to define the following variables:

  * <NAME>_FOUND
  * <NAME>_INCLUDE_DIRS
  * <NAME>_LIBRARIES
  * <NAME>_DEFINITIONS

I can't find any clear documentation concerning <NAME>_DEFINITION.
Should I export the definitions prefixed with or without "-D".

To be clear, if the package neads to be build with
add_definitions("-DMY_DEF")
in <NAME>Config.cmake should I set <NAME>_DEFINITIONS var as "MY_DEF" or 
"-DMY_DEF" ?

I would prefer "-DMY_DEF" so that in the project that will use my 
package I can simply call
add_definitions(${<NAME>_DEFINITIONS}), but I'm not sure this is the 
recommended ?


Thanks
Fabien

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141012/8f55fe78/attachment.html>


More information about the CMake mailing list