Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/dyninst/cmake/Modules/FindElfutils.cmake
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

134 lines
3.9 KiB
CMake

#[=======================================================================[.rst:
FindElfutils
------------
Find elfutils, a collection of utilities and libraries to read, create
and modify ELF binary files, find and handle DWARF debug data,
symbols, thread state and stacktraces for processes and core files
on GNU/Linux.
Variables that affect this module
``ElfUtils_NO_SYSTEM_PATHS``
If `True`, no system paths are searched.
Imported targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
``Elfutils::Elfutils``
The elfutils library, if found.
This module will set the following variables in your project:
``Elfutils_INCLUDE_DIRS``
where to find elfutils headers
``Elfutils_LIBRARIES``
the libraries to link against to use elfutils.
``Elfutils_FOUND``
If false, do not try to use elfutils.
``Elfutils_VERSION``
the version of the elfutils library found
Support for libdebuginfod can be added by specifying it in ``COMPONENTS``.
.. code-block:: cmake
find_package(Elfutils 0.186 EXACT REQUIRED COMPONENTS debuginfod)
#]=======================================================================]
cmake_policy(SET CMP0074 NEW) # Use <Package>_ROOT
if(${Elfutils_FIND_REQUIRED})
set(_required "REQUIRED")
endif()
if(${Elfutils_FIND_QUIETLY})
set(_quiet "QUIET")
endif()
if(${Elfutils_FIND_EXACT})
set(_exact "EXACT")
endif()
# Propagate ElfUtils_NO_SYSTEM_PATHS
foreach(_n "LibELF" "LibDW" "LibDebuginfod")
set(${_n}_NO_SYSTEM_PATHS ${ElfUtils_NO_SYSTEM_PATHS})
mark_as_advanced(${_n}_NO_SYSTEM_PATHS)
# Force the search directory
if(ElfUtils_NO_SYSTEM_PATHS)
set(${_n}_ROOT ${ElfUtils_ROOT_DIR})
mark_as_advanced(${_n}_ROOT)
endif()
endforeach()
find_package(LibELF ${Elfutils_FIND_VERSION} ${_exact} ${_required} ${_quiet})
find_package(LibDW ${Elfutils_FIND_VERSION} ${_exact} ${_required} ${_quiet})
if(NOT "x${Elfutils_FIND_COMPONENTS}" STREQUAL "x")
string(TOUPPER ${Elfutils_FIND_COMPONENTS} _tmp)
if(NOT ${_tmp} STREQUAL "DEBUGINFOD")
message(FATAL "Unknown component: '${Elfutils_FIND_COMPONENTS}'")
endif()
find_package(LibDebuginfod ${Elfutils_FIND_VERSION} ${_exact} ${_required} ${_quiet})
set(_need_debuginfod TRUE)
unset(_tmp)
endif()
# Ensure that each component has the same version number
set(_versions ${LibDW_VERSION} ${LibELF_VERSION} ${LibDebuginfod_VERSION})
list(REMOVE_DUPLICATES _versions)
list(LENGTH _versions _len)
if(${_len} GREATER 1)
message(FATAL_ERROR "Elfutils: conflicting versions found: (${_versions})")
endif()
unset(_len)
set(Elfutils_VERSION ${_versions})
unset(_versions)
include(FindPackageHandleStandardArgs)
if(${_need_debuginfod})
find_package_handle_standard_args(
Elfutils
FOUND_VAR Elfutils_FOUND
REQUIRED_VARS LibDW_INCLUDE_DIRS LibDW_LIBRARIES LibELF_INCLUDE_DIRS LibELF_LIBRARIES
LibDebuginfod_INCLUDE_DIRS LibDebuginfod_LIBRARIES
VERSION_VAR Elfutils_VERSION)
else()
find_package_handle_standard_args(
Elfutils
FOUND_VAR Elfutils_FOUND
REQUIRED_VARS LibDW_INCLUDE_DIRS LibDW_LIBRARIES LibELF_INCLUDE_DIRS LibELF_LIBRARIES
VERSION_VAR Elfutils_VERSION)
endif()
if(Elfutils_FOUND)
set(Elfutils_INCLUDE_DIRS
${LibDW_INCLUDE_DIRS} ${LibELF_INCLUDE_DIRS} ${LibDebuginfod_INCLUDE_DIRS}
CACHE PATH "")
mark_as_advanced(Elfutils_INCLUDE_DIRS)
set(Elfutils_LIBRARIES
${LibDW_LIBRARIES} ${LibELF_LIBRARIES} ${LibDebuginfod_LIBRARIES}
CACHE PATH "")
mark_as_advanced(Elfutils_LIBRARIES)
mark_as_advanced(Elfutils_VERSION)
if(NOT TARGET Elfutils::Elfutils)
add_library(Elfutils::Elfutils INTERFACE IMPORTED)
target_link_libraries(Elfutils::Elfutils INTERFACE LibELF::LibELF LibDW::LibDW)
if(${_need_debuginfod})
target_link_libraries(Elfutils::Elfutils INTERFACE LibDebuginfod::LibDebuginfod)
endif()
endif()
endif()
unset(_exact)
unset(_quiet)
unset(_required)
unset(_need_debuginfod)