Skip to content

Using GLAMER in your project

Nicolas Tessore edited this page Mar 26, 2015 · 1 revision

Once the GLAMER libraries are built inside your build tree, they can be linked with your executables as usual. However, you might want to try and manage your project with CMake instead.

Having built the GLAMER libraries with CMake makes it easy to integrate them into projects. Most of the process is automated by CMake. It is important to have built GLAMER before setting up a project, since CMake then remembers where to find the libraries.

Creating new projects

The easiest way to start a project is to copy the sample project from the examples/project folder. In the enclosed CMakeLists.txt file, all instances of the "sample" name have to be replaced with the actual name of the project. Sources and headers can be added to the appropriate lists.

Existing cmake projects

For projects already using CMake, integrating GLAMER is as simple as calling

find_package(GLAMER NO_MODULE REQUIRED)

before creating any targets. This will load the GLAMER configuration, import the library targets and set variables containing the include directories and libraries necessary for GLAMER, including all dependencies. These can then be set using the usual

include_directories(${GLAMER_INCLUDE_DIRS})

and

target_link_libraries(<target> ${GLAMER_LIBRARIES})

functions.

Building projects

Projects are built using CMake in the same way the libraries are built. After creating a build tree, cmake will configure and generate a project which can subsequently be used with the build tool of choice.

$ cd myproject
$ ls
CMakeLists.txt  main.cpp
$ mkdir build
$ cmake .. -G Xcode
$ open myproject.xcodeproj

Note: Building the project will not build the GLAMER libraries automatically!