cereal icon indicating copy to clipboard operation
cereal copied to clipboard

[very noob question] how can get cmake cereal "INCLUDE_DIR" definition with find_package(cereal)?

Open sl1pkn07 opened this issue 7 years ago • 3 comments

Hi, i want to get the definition "cereal_INCLUDE_DIR" from cmake with find_package(Cereal)

but only got

cereal_DIR:PATH=/usr/share/cmake/cereal

how to get the "INCLUDE_DIR" definition?

sorry for this stupid question, but this drive me crazy

greetings

sl1pkn07 avatar May 18 '18 22:05 sl1pkn07

This is probably better suited for stack overflow or potentially the mailing list. I'm not very well versed in cmake.

AzothAmmo avatar Jul 02 '18 05:07 AzothAmmo

I also stumbled upon this question; It seems you are simply supposed to use add_dependencies. Say:

find_package(cereal REQUIRED)
add_dependencies(yourtarget cereal)

Also, since cereal is a header only library and typically installs itself in a sensible directory, you can probably often get away with simply including <cereal/cereal.hpp>. The find_package then only functions to communicate you need to install cereal.

marijnfs avatar Nov 03 '19 22:11 marijnfs

Is this still the recommended way to include cereal? I'm wondering, what folder is one supposed to give to cereal_DIR? It searches for the config.cmake files which don't exist in the source directory.

codeling avatar Oct 27 '21 14:10 codeling