DGtal
1.5.beta
|
Once you have installed the DGtal library, this documentation describes the ways to link your project and the installed DGtal libs and making sure that the dependencies are correct.
We recommend to use the cmake system since using a simple command, all dependencies used to build your installed DGtal version will be associated and linked to your project.
Let us consider the following helloworld project with the C++ file helloworld.cpp :
This simple example just use the "trace" mechanism in DGtal but it requires helloworld.cpp to be linked to DGtal.
To compile this file with cmake, you have a CMakeLists.txt file that looks like:
When you installed DGtal, cmake created all the configuration files that you would need to import DGtal settings in your project in the "${CMAKE_INSTALL_PREFIX}/share/DGtal/CMake/" folder. For example on linux/unix systems, standard installation creates configuration files in /usr/local/share/DGtal/CMake/".
The most important file in this folder is DGtalConfig.cmake which contains everything you need. Just copy (or better, link) this file in your project source directory. Then, to link helloworld to DGtal, you just have to update the CMakeLists.txt such that:
Additionally, you can control the version of the DGtal library with for example :
that will produce an error if your DGtal installed library has an older version than 0.3.1.