1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
# SPDX-License-Identifier: LGPL-2.1
#[=======================================================================[.rst:
FindTraceCmd
-------
Finds the tracecmd library.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the :prop_tgt:`IMPORTED` targets:
``trace::cmd``
Defined if the system has libtracecmd.
Result Variables
^^^^^^^^^^^^^^^^
``TraceCmd_FOUND``
True if the system has the libtracecmd library.
``TraceCmd_VERSION``
The version of the libtracecmd library which was found.
``TraceCmd_INCLUDE_DIRS``
Include directories needed to use libtracecmd.
``TraceCmd_LIBRARIES``
Libraries needed to link to libtracecmd.
Cache Variables
^^^^^^^^^^^^^^^
``TraceCmd_INCLUDE_DIR``
The directory containing ``trace-cmd.h``.
``TraceCmd_LIBRARY``
The path to the tracecmd library.
#]=======================================================================]
find_package(PkgConfig QUIET)
pkg_check_modules(PC_TraceCmd QUIET libtracecmd)
set(TraceCmd_VERSION ${PC_TraceCmd_VERSION})
set(TraceCmd_DEFINITIONS ${PC_TraceCmd_CFLAGS_OTHER})
find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd.h
HINTS ${PC_TraceCmd_INCLUDE_DIRS}
${PC_TraceCmd_INCLUDEDIR})
find_library(TraceCmd_LIBRARY NAMES tracecmd libtracecmd
HINTS ${PC_TraceCmd_LIBDIR}
${PC_TraceCmdLIBRARY_DIRS})
mark_as_advanced(TraceCmd_INCLUDE_DIR TraceCmd_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TraceCmd DEFAULT_MSG
TraceCmd_LIBRARY TraceCmd_INCLUDE_DIR)
if(TraceCmd_FOUND)
set(TraceCmd_LIBRARIES ${TraceCmd_LIBRARY})
set(TraceCmd_INCLUDE_DIRS ${TraceCmd_INCLUDE_DIR})
if(NOT TARGET trace::cmd)
add_library(trace::cmd UNKNOWN IMPORTED)
set_target_properties(trace::cmd
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${TraceCmd_INCLUDE_DIRS}"
INTERFACE_COMPILE_DEFINITIONS "${TraceCmd_DEFINITIONS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${TraceCmd_LIBRARIES}")
endif()
endif()
find_program(TRACECMD_EXECUTABLE NAMES trace-cmd)
|