]> git.saurik.com Git - apple/libdispatch.git/blob - cmake/modules/DTrace.cmake
libdispatch-913.30.4.tar.gz
[apple/libdispatch.git] / cmake / modules / DTrace.cmake
1
2 function(dtrace_usdt_probe script)
3 set(options)
4 set(single_parameter_options TARGET_NAME OUTPUT_SOURCES)
5 set(multiple_parameter_options)
6
7 cmake_parse_arguments("" "${options}" "${single_parameter_options}" "${multiple_parameter_options}" ${ARGN})
8
9 get_filename_component(script_we ${script} NAME_WE)
10
11 add_custom_command(OUTPUT
12 ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
13 COMMAND
14 ${dtrace_EXECUTABLE} -h -s ${script} -o ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h
15 DEPENDS
16 ${script})
17 add_custom_target(dtrace-usdt-header-${script_we}
18 DEPENDS
19 ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h)
20 if(_TARGET_NAME)
21 set(${_TARGET_NAME} dtrace-usdt-header-${script_we} PARENT_SCOPE)
22 endif()
23 if(_OUTPUT_SOURCES)
24 set(${_OUTPUT_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${script_we}.h PARENT_SCOPE)
25 endif()
26 endfunction()