diff --git a/cmake/modules/UseMakePluginReg.cmake b/cmake/modules/UseMakePluginReg.cmake index 19f0e9bf40..e6e6a9193d 100644 --- a/cmake/modules/UseMakePluginReg.cmake +++ b/cmake/modules/UseMakePluginReg.cmake @@ -1,9 +1,10 @@ # -MACRO(REGISTER_PLUGIN_FILES _outputfile _registertype ) +function(register_plugin_files _outputfile _registertype) include(LocatePythonModule) locate_python_module(make-plugin-reg REQUIRED PATHS ${CMAKE_SOURCE_DIR}/tools) - ADD_CUSTOM_COMMAND( + file(RELATIVE_PATH output "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${_outputfile}") + add_custom_command( OUTPUT ${_outputfile} COMMAND ${PYTHON_EXECUTABLE} @@ -11,8 +12,9 @@ MACRO(REGISTER_PLUGIN_FILES _outputfile _registertype ) ${CMAKE_CURRENT_SOURCE_DIR} ${_registertype} ${ARGN} + COMMENT "Generating ${output}" DEPENDS ${ARGN} ${PY_MAKE-PLUGIN-REG} ) -ENDMACRO(REGISTER_PLUGIN_FILES) +endfunction() diff --git a/tools/make-plugin-reg.py b/tools/make-plugin-reg.py index 946edb8d3b..455936032a 100755 --- a/tools/make-plugin-reg.py +++ b/tools/make-plugin-reg.py @@ -2,6 +2,7 @@ # # Looks for registration routines in the plugins # and assembles C code to call all the routines. +# A new "plugin.c" file will be written in the current directory. # import os @@ -28,7 +29,7 @@ preamble = """\ * * Generated automatically from %s. */ -""" % (sys.argv[0]) +""" % (os.path.basename(sys.argv[0])) # Create the proper list of filenames filenames = [] @@ -165,7 +166,6 @@ try: fh = open(final_filename, 'w') fh.write(reg_code) fh.close() - print('Generated {} for {}.'.format(final_filename, os.path.basename(srcdir))) except OSError: sys.exit('Unable to write ' + final_filename + '.\n')