[CMake] How to report deprecated functionalities (subdirs, install_files...)

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Jul 16 11:29:57 EDT 2009


On Thu, Jul 16, 2009 at 5:01 PM, Mathieu
Malaterre<mathieu.malaterre at gmail.com> wrote:
> On Thu, Jul 16, 2009 at 4:58 PM, Michael
> Jackson<mike.jackson at bluequartz.net> wrote:
>>
>>
>> On Jul 16, 2009, at 10:41 AM, Mathieu Malaterre wrote:
>>
>>> On Thu, Jul 16, 2009 at 4:32 PM, David Cole<david.cole at kitware.com> wrote:
>>>>
>>>> There is not a built-in method of identifying code like that, although
>>>> that
>>>> would be a good feature request. Especially if it had a patch attached to
>>>> it... :-)
>>>
>>> I can open a feature request :-)
>>>
>>>> You could try this at the top of your CMakeLists.txt file:
>>>> function(SUBDIRS)
>>>>  message(FATAL_ERROR "error: using deprecated SUBDIRS")
>>>> endfunction()
>>>> Does CMake give you line number information if you create such a
>>>> function?
>>>
>>> Yup, it does.
>>>
>>>
>>> CMake Error at CMakeLists.txt:14 (message):
>>>  error: using deprecated SUBDIRS
>>> Call Stack (most recent call first):
>>>  CMakeLists.txt:175 (SUBDIRS)
>>>
>>> The second one is the one you are looking for, so this should work. I
>>> just need to know how to pass Warning/Error to cdash now :)
>>>
>>> Thanks,
>>> --
>>> Mathieu
>>>
>>
>> This is from 2.6.4 list of "Compatibility Commands". I would say put this
>> into a file called "CheckDeprecated.cmake" and include it into your top
>> level project?
>>
>>
>> function(build_name)
>>  message(FATAL_ERROR "error: using deprecated build_name")
>> endfunction()
>
> <...>
>
> Awesome ! Thank you very much :)

I thought I would be able to use a warning instead of an error, now
that I know how to report it to cdash, but the following fails ...
recursively :)

function(SUBDIRS)
  message(STATUS "Warning: using deprecated SUBDIRS")
  SUBDIRS( ${ARGV} )
endfunction()


-- 
Mathieu


More information about the CMake mailing list