soprano cmake patch - making backends optional

Alexander Neundorf neundorf at kde.org
Thu Jan 29 18:57:32 CET 2009


On Thursday 29 January 2009, Maciej Mrozowski wrote:
> This is a bit better one, tell me what do you think.
>
> Unfortunately I cannot use macro_optional_find_package() everywhere as it
> creates variable with name ENABLE_${pkgname} where pkgname is cmake
> Find${pkgname} module name, and in case of Sesame2 it would be WITH_JNI -
> pretty much non-informative.
> So, as summary is already displayed, I decided to just add option() and not
> make use of macro_optional_find_package and macro_log_feature.
> Besides macro_optional_find_package adds variable with WITH_ prefix (and
> when I cannot use it in sesame, it would result in WITH_Redland,
> ENABLE_Sesam2 - and both are storage backends - it would be bad).
> Besides I added ENABLE_docs for apidox generation as well and ENABLE_tests
> for building tests.
> As far as tests are concerned, ctest scans all targets that have been built
> in project(${projectname}_test) as I suppose, and only these tests are
> build for those prerequisites have been found, so no test for non-existing
> backend will be run (this is what Ingmar was afraid of) - this has been
> verified.
>
> About macros, I find them not yet flexible as one would expect (or maybe
> there's some macro I don't know about) - what I would like to have in *one*
> macro and what I'm probably going to write in a future:
> - ability to add package module name in macro (already in
> macro_optional_find_package)

Ok.

> - ability to specify variable prefix (WITH_ or ENABLE_ or some other) 
> and of course default value

It would be nice if you could add this as additional optional parameter to
macro_optional_find_package():
macro_optional_find_package([VAR_NAME <name>] [DEFAULT <enabled>] ...)

> - ability to specify description/homepage (something like in
> macro_log_feature)

Hmm, no.
CMake 2.6 has the feature to collect information about find_package(), it's 
just not used yet. So this information should be set ideally inside the cmake 
modules. See CMake/Modules/FeatureSummary.cmake.

> - ability to specify whether package is required (variable would not be
> specified - maybe I could write another version of this macro for finding
> packages that are required)

Just use the REQUIRED keyword as with normal FIND_PACKAGE(), all arguments are 
handed over to FIND_PACKAGE().

> - ability to specify package version along with version operator (and
> automatic verification - setting to NOTFOUND when too old or just not the
> one as requested) - unfortunately - all FindXXX modules or some other
> mechanism would need to start returning detected package version.

This is supported by FIND_PACKAGE(), and so it is also supported by 
MACRO_OPTIONAL_FIND_PACKAGE(), no change necessary.

Alex


More information about the Kde-buildsystem mailing list