[CMake] Issues with finding raptor in the soprano build

Michael Wild themiwi at gmail.com
Wed Nov 16 09:45:11 EST 2011


Alex recently also asked something to this effect on the list...

IMHO it would be best to copy the module verbatim and then in the copy
do something like this at the very top:

if(EXISTS ${CMAKE_ROOT}/Modules/Foo.cmake)
  include(${CMAKE_ROOT}/Modules/Foo.cmake)
else()
...
endif()

Either put the whole contents of the copy into the else() part of the
conditional (compatible with very old versions of CMake), or
alternatively remove the whole else() branch and call return() after the
include() call. But then again, return() requires CMake 2.6.2 in this
context, so, depending on your needs, either choose the ugly else()
approach, or use return().

Using this scheme you only use your local copy if CMake doesn't provide
it. Of course, you can be more elaborate if you know certain versions of
the CMake-provided file to be buggy, and discriminate based on the
CMAKE_VERSION variable.

HTH

Michael

On 11/16/2011 12:42 PM, Laszlo Papp wrote:
> The soprano author seems to keep a local copy of that macro:
> https://projects.kde.org/projects/kdesupport/soprano/repository/revisions/master/entry/cmake/modules/FindPackageHandleStandardArgs.cmake
> 
> It is probably outdated since "vimdiff
> /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake
> ../cmake/modules/FindPackageHandleStandardArgs.cmake" gives a lot of
> differences.
> 
> Would it be possible to just update that file from upstream cmake, and
> be done ? What is the general approach suggested for developers to
> invoke cmake in such situations where it needs to run with old and new
> cmake versions, too ?
> 
> 1. Using the compatible old version everywhere, if possible ?
> 2. Keep local copies of such modules
> 3. Something else ?
> 
> Best Regards,
> Laszlo Papp
> 
> On Wed, Nov 16, 2011 at 11:39 AM, Michael Wild <themiwi at gmail.com> wrote:
>> On 11/16/2011 09:35 AM, Laszlo Papp wrote:
>>>> What version of CMake are you using? The extended signature of
>>>> find_package_handle_standard_args() you use in FindRaptor.cmake became
>>>> only available in CMake 2.8.4.
>>>
>>> Sadly 2.8.2 is the available version:
>>> http://harmattan-dev.nokia.com/pool/harmattan-beta3/free/c/cmake/
>>>
>>> I was claiming a lot internally we should update it on Harmattan, but
>>> I have not found anybody really supporting this idea. :/
>>>
>>> What would be the workaround for our environment ? Patch the
>>> FindRaptor.cmake file ? If yes, can someone give a hint, how ?
>>>
>>> Best Regards,
>>> Laszlo Papp
>>
>> You could handle version detection manually. Something like this should do:
>>
>> set(RAPTOR_VERSION_IS_OK TRUE)
>> if(Raptor_FIND_VERSION)
>>  if(Raptor_FIND_VERSION_EXACT AND
>>      NOT ${RAPTOR_VERSION} VERSION_EQUAL ${Raptor_FIND_VERSION})
>>    set(RAPTOR_VERSION_IS_OK FALSE)
>>  elseif(${RAPTOR_VERSION} VERSION_LESS ${Raptor_FIND_VERSION})
>>    set(RAPTOR_VERSION_IS_OK FALSE)
>>  endif()
>> endif()
>>
>> And then use RAPTOR_VERSION_IS_OK in the
>> find_package_handle_standard_args() call.
>>
>> Michael
>>



More information about the CMake mailing list