Jaak, Troy, On Tue, Oct 25, 2011 at 9:37 AM, Troy A. Griffitts <scr...@crosswire.org> wrote: > Hey Jaak, > > I can see how this is useful, though I believe the standard way to handle > this with any package is to define what you need with, e.g., > > pkg-config --atleast-version=1.6.2 sword
In CMAKE this is made very easy, assuming that the --mod-version of sword is placed in the CMake variable SWORD_VERSION to do IF(SWORD_VERSION VERSION_GREATER "1.6.2") ADD_DEFINITIONS(-DENABLE_FEATURE) ENDIF(SWORD_VERSION VERSION_GREATER "1.6.2") which obviates the need for the complicated shell results below. This is the method I use in the CLucene detection version. It properly handles the presence of non-digit characters, differentiates between 1.6.2 and 1.6.12 in a way that STRGREATER does not and so on. > > You can define what you want, like INCLUDES_WLC_VERSIFICATION, or whatever > you need to have special code for, based on the SWORD library version. > Unless you change the whole world of package versioning formats, I'm not > sure it helps much for just us to add a new format. If you still want to > use the comparable version number in your code, you could currently do > something like > > SWORD_VERSION := $(shell pkg-config --modversion sword | awk -F. > '{printf("%0.2x%0.2x%0.2x\n",$$1,$$2,$$3)}') > CFLAGS += -DSWORD_VERSION=0x$(SWORD_VERSION) With CMake magic like this becomes unnecessary. > > which would also work for you with any package. > > Hope this helps. If you still think we should define a special hex version > number in future releases, please let me know. On the other hand, I have found that it is common for libraries to include something along the lines of what Jaak is asking for, Qt not being the only place I've encountered it. I have also seen variables for SWORD_MAJOR=1, SWORD_MINOR=6 and SWORD_PATCH=2 or something akin to that with the appropriate values included. It would be a rather straightforward matter to include these in SWORD's header files, no? --Greg _______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page