Files
rocm-systems/projects/rocprofiler-systems/examples/code-coverage/CMakeLists.txt
T
Kian Cossettini 9f014db6a4 [rocprofiler-systems] Update install path for examples (#2625)
* Update install path for examples to `share/rocprofiler-systems/examples`

----

Co-authored-by: Kian Cossettini <Kian.Cossettini@amd.com>
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
2026-01-15 21:51:16 -05:00

58 строки
1.6 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(rocprofiler-systems-code-coverage-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
find_package(Threads REQUIRED)
add_executable(code-coverage code-coverage.cpp)
target_link_libraries(code-coverage PRIVATE Threads::Threads)
target_compile_options(code-coverage PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS code-coverage
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-systems/examples
COMPONENT rocprofiler-systems-examples
)
endif()
set(PYTHON_FILES code-coverage.py)
find_package(Python3 COMPONENTS Interpreter)
if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(
${PROJECT_SOURCE_DIR}/${_FILE}
${PROJECT_BINARY_DIR}/${_FILE}
@ONLY
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-systems/examples
COMPONENT rocprofiler-systems-examples
)
endif()
endforeach()
endif()