Files
TheRock/rocm-systems/projects/rocprofiler-systems/cmake/Modules/FindLibIberty.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

87 lines
3.1 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# ========================================================================================
# FindLibIberty.cmake
#
# Find LibIberty include dirs and libraries
#
# ----------------------------------------
#
# Use this module by invoking find_package with the form::
#
# find_package(LibIberty [REQUIRED] # Fail with error if LibIberty is not
# found )
#
# This module reads hints about search locations from variables::
#
# LibIberty_ROOT_DIR - Base directory the of LibIberty installation
# LibIberty_LIBRARYDIR - Hint directory that contains the LibIberty library files
# IBERTY_LIBRARIES - Alias for LibIberty_LIBRARIES (backwards compatibility only)
# LibIberty_INCLUDEDIR - Hint directory that contains the libiberty headers files
#
# and saves search results persistently in CMake cache entries::
#
# LibIberty_FOUND - True if headers and requested libraries were found
# IBERTY_FOUND - Alias for LibIberty_FOUND (backwards compatibility only)
# LibIberty_INCLUDE_DIRS - libiberty include directories LibIberty_LIBRARY_DIRS - Link
# directories for LibIberty libraries LibIberty_LIBRARIES - LibIberty library files
# IBERTY_LIBRARIES - Alias for LibIberty_LIBRARIES (backwards compatibility only)
#
# ========================================================================================
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
# Keep the semantics of IBERTY_LIBRARIES for backward compatibility NB: If both are
# specified, LibIberty_LIBRARIES is ignored
if(NOT "${IBERTY_LIBRARIES}" STREQUAL "")
set(LibIberty_LIBRARIES ${IBERTY_LIBRARIES})
endif()
# Non-standard subdirectories to search
set(_path_suffixes libiberty iberty)
find_path(
LibIberty_INCLUDE_DIRS
NAMES libiberty.h
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_ROOT_DIR}/include ${LibIberty_INCLUDEDIR}
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
PATH_SUFFIXES ${_path_suffixes}
DOC "LibIberty include directories"
)
# iberty_pic is for Debian <= wheezy
find_library(
LibIberty_LIBRARIES
NAMES iberty_pic iberty
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_LIBRARYDIR} ${IBERTY_LIBRARIES}
PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS}
PATH_SUFFIXES ${_path_suffixes}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
LibIberty
FOUND_VAR LibIberty_FOUND
REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES
)
# For backwards compatibility only
set(IBERTY_FOUND ${LibIberty_FOUND})
if(LibIberty_FOUND)
foreach(l ${LibIberty_LIBRARIES})
get_filename_component(_dir ${l} DIRECTORY)
if(NOT "${_dir}" IN_LIST LibIberty_LIBRARY_DIRS)
list(APPEND LibIberty_LIBRARY_DIRS ${_dir})
endif()
endforeach()
add_library(LibIberty::LibIberty INTERFACE IMPORTED)
target_include_directories(LibIberty::LibIberty INTERFACE ${LibIberty_INCLUDE_DIRS})
target_link_libraries(LibIberty::LibIberty INTERFACE ${LibIberty_LIBRARIES})
# For backwards compatibility only
set(IBERTY_LIBRARIES ${LibIberty_LIBRARIES})
endif()