DTrace.cmake 979 B

1234567891011121314151617181920212223242526
  1. function(dtrace_usdt_probe script)
  2. set(options)
  3. set(single_parameter_options TARGET_NAME OUTPUT_SOURCES)
  4. set(multiple_parameter_options)
  5. cmake_parse_arguments("" "${options}" "${single_parameter_options}" "${multiple_parameter_options}" ${ARGN})
  6. get_filename_component(script_we ${script} NAME_WE)
  7. add_custom_command(OUTPUT
  8. ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
  9. COMMAND
  10. ${dtrace_EXECUTABLE} -h -s ${script} -o ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
  11. DEPENDS
  12. ${script})
  13. add_custom_target(dtrace-usdt-header-${script_we}
  14. DEPENDS
  15. ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h)
  16. if(_TARGET_NAME)
  17. set(${_TARGET_NAME} dtrace-usdt-header-${script_we} PARENT_SCOPE)
  18. endif()
  19. if(_OUTPUT_SOURCES)
  20. set(${_OUTPUT_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h PARENT_SCOPE)
  21. endif()
  22. endfunction()