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

Michael Jackson mike.jackson at bluequartz.net
Thu Jul 16 10:58:29 EDT 2009



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()
function(exec_program)
   message(FATAL_ERROR "error: using deprecated exec_program")
endfunction()
function(export_library_dependencies)
   message(FATAL_ERROR "error: using deprecated  
export_library_dependencies")
endfunction()
function(install_files)
   message(FATAL_ERROR "error: using deprecated install_files")
endfunction()
function(install_programs)
   message(FATAL_ERROR "error: using deprecated install_programs")
endfunction()
function(install_targets)
   message(FATAL_ERROR "error: using deprecated install_targets")
endfunction()
function(link_libraries)
   message(FATAL_ERROR "error: using deprecated link_libraries")
endfunction()
function(make_directory)
   message(FATAL_ERROR "error: using deprecated make_directory")
endfunction()
function(remove)
   message(FATAL_ERROR "error: using deprecated remove")
endfunction()
function(subdir_depends)
   message(FATAL_ERROR "error: using deprecated subdir_depends")
endfunction()
function(subdirs)
   message(FATAL_ERROR "error: using deprecated subdirs")
endfunction()
function(use_mangled_mesa)
   message(FATAL_ERROR "error: using deprecated use_mangled_mesa")
endfunction()
function(utility_source)
   message(FATAL_ERROR "error: using deprecated utility_source")
endfunction()
function(variable_requires)
   message(FATAL_ERROR "error: using deprecated variable_requires")
endfunction()
function(write_file)
   message(FATAL_ERROR "error: using deprecated write_file")
endfunction()

Mike



More information about the CMake mailing list