1f1603f8cSMark NunbergFIND_PROGRAM(DTRACE dtrace)
2f1603f8cSMark NunbergIF(DTRACE)
3f1603f8cSMark Nunberg    ADD_DEFINITIONS(-DHAVE_DTRACE)
4f1603f8cSMark Nunberg    SET(LCB_DTRACE_HEADER "${LCB_GENSRCDIR}/probes.h")
52a07f70bSMark Nunberg    SET(LCB_DTRACE_SRC "${PROJECT_SOURCE_DIR}/src/probes.d")
6f1603f8cSMark Nunberg
7f1603f8cSMark Nunberg    # Generate probes.h
8f1603f8cSMark Nunberg    EXECUTE_PROCESS(COMMAND ${DTRACE} -C -h -s ${LCB_DTRACE_SRC} -o ${LCB_DTRACE_HEADER})
9f1603f8cSMark Nunberg
10f1603f8cSMark Nunberg    IF(NOT APPLE)
11f1603f8cSMark Nunberg        SET(LCB_DTRACE_OBJECT "${LCB_GENSRCDIR}/probes.o")
12f1603f8cSMark Nunberg        # Generate probes.o
1311e5515bSMark Nunberg        IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
1411e5515bSMark Nunberg            SET(LCB_DTRACE_INSTRO ON)
1511e5515bSMark Nunberg            UNSET(LCB_DTRACE_OBJECT)
1611e5515bSMark Nunberg        ELSE()
1711e5515bSMark Nunberg            ADD_CUSTOM_COMMAND(OUTPUT ${LCB_DTRACE_OBJECT}
1811e5515bSMark Nunberg                DEPENDS ${LCB_DTRACE_SRC}
1911e5515bSMark Nunberg                COMMAND ${DTRACE} -C -G ${LCB_DTRACE_OPTIONS} -s ${LCB_DTRACE_SRC} -o ${LCB_DTRACE_OBJECT})
2011e5515bSMark Nunberg        ENDIF()
21f1603f8cSMark Nunberg    ENDIF()
22f1603f8cSMark NunbergENDIF()
23