← Back to team overview

elementary-dev-community team mailing list archive

CMake and Build-class

 

 

Dear elementary-devs, 

When looking at Noise's code, there is a
nice integration between CMake and the code itself via the Build-class:
some properties defined in Noise can be accessed in the vala code this
way: 

// App info
build_data_dir = Build.DATADIR;
build_pkg_data_dir =
Build.PKG_DATADIR;
build_release_name =
Build.RELEASE_NAME;
build_version = Build.VERSION;
build_version_info =
Build.VERSION_INFO;

In this example, the properties DATADIR,
PKG_DATADIR etc. are defined in CMakeLists.txt and I think this is great
as you have to change the properties only in one place.

However, when
trying to use this concept in one of my own projects, I can't find a way
how to use this snippet. Where is this Build-class declared or how are
these variables linked from CMakeLists.txt to the vala source code file?
Do I have to add a specific class or should I add something to the
CMakeLists.txt file?

Thanks for your help!

Kind regards

Kurt

 

Follow ups