Files
rocm-systems/examples/code-coverage/CMakeLists.txt
T

48 lines
1.4 KiB
CMake
Raw Normal View History

2022-04-25 17:00:52 -05:00
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
2022-11-01 17:28:12 -05:00
project(omnitrace-code-coverage-example LANGUAGES CXX)
if(OMNITRACE_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
OMNITRACE_DISABLE_EXAMPLES)
return()
endif()
endif()
2022-04-25 17:00:52 -05:00
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)
2022-04-25 17:00:52 -05:00
target_compile_options(code-coverage PRIVATE ${_FLAGS})
if(OMNITRACE_INSTALL_EXAMPLES)
install(
TARGETS code-coverage
DESTINATION bin
COMPONENT omnitrace-examples)
2022-04-25 17:00:52 -05:00
endif()
2022-10-31 15:39:45 -05:00
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(OMNITRACE_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION bin
COMPONENT omnitrace-examples)
endif()
endforeach()
endif()