[CMake] RPM packaging dependencies expressed in subdirectories

Nils Gladitz nilsgladitz at gmail.com
Wed Jul 16 11:40:33 EDT 2014


On 16.07.2014 16:37, Thibault Hild wrote:
> Thanks Nils for the hint.
>
> I guess you had to use Cmake constructs like:
> if("new dep" MATCHES "a regex built with ${pack_deps}")
> in order to decide whether a new dependency is allowed.
>
> As I am quite new to CMake functions, can you detail a bit how do you 
> operate such validation ?

I got the current list of dependencies with get_property().
Then I looped over the list with foreach().
Every list item I split into name and version (with regex) and then 
compared it to the new dependency.
I used message(FATAL_ERROR) to issue a (fatal) diagnostic if a different 
version of a dependency has already been requested.

> Is there some sort of function repository to share these custom CMake 
> function tools ?

I am not aware of any except for cmake's own module repository[1] ... 
which might not be the right place for this though.
Perhaps the Wiki.

Nils

[1] http://www.cmake.org/cmake/help/v3.0/manual/cmake-modules.7.html


More information about the CMake mailing list