Files
TheRock/rocm-libraries/cmake/modules/add_subdirectory_with_message.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

37 lines
1.4 KiB
CMake

# Copyright Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT
# Adds a subdirectory to the build with a status message,
# and optionally checks for an expected target.
#
# Usage:
# add_subdirectory_with_message(COMPONENT <component> PREFIX_PATH <prefix> [EXPECT_TARGET <target>])
#
# Arguments:
# COMPONENT <component> - Component name (e.g., "mxdatagenerator").
# PREFIX_PATH <prefix> - Path prefix (e.g., "shared", "projects").
# EXPECT_TARGET <target> - Optional target name produced by the subdirectory.
function(add_subdirectory_with_message)
cmake_parse_arguments(ARG "" "COMPONENT;PREFIX_PATH;EXPECT_TARGET" "" ${ARGN})
if(NOT ARG_COMPONENT)
message(FATAL_ERROR "add_subdirectory_with_message: COMPONENT is required")
endif()
if(NOT ARG_PREFIX_PATH)
message(FATAL_ERROR "add_subdirectory_with_message: PREFIX_PATH is required")
endif()
set(_subdir_path "${CMAKE_CURRENT_SOURCE_DIR}/${ARG_PREFIX_PATH}/${ARG_COMPONENT}")
file(TO_CMAKE_PATH "${_subdir_path}" _subdir_path)
list(APPEND CMAKE_MESSAGE_CONTEXT "${ARG_COMPONENT}")
add_subdirectory("${_subdir_path}")
if(ARG_EXPECT_TARGET AND NOT TARGET ${ARG_EXPECT_TARGET})
message(FATAL_ERROR "Expected target ${ARG_EXPECT_TARGET} not found in ${_subdir_path}")
endif()
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endfunction()