From 5a6f6ed83de8c32e319807b20a23c906a08ff9fd Mon Sep 17 00:00:00 2001 From: darren-amd Date: Mon, 16 Dec 2024 14:31:56 -0500 Subject: [PATCH] Allow disabling of openmp examples (#64) Add flag to disable openmp examples Co-authored-by: David Galiffi --------- Co-authored-by: David Galiffi [ROCm/rocprofiler-systems commit: 888b9a43a0196ee605d85f0f70fb3ebe37ad3491] --- .../examples/openmp/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt index c7451766f7..2b3c7e6199 100644 --- a/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/openmp/CMakeLists.txt @@ -2,6 +2,15 @@ cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR) project(rocprofiler-systems-openmp 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() + file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp) add_library(openmp-common OBJECT ${common_source}) target_include_directories(openmp-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common) @@ -57,4 +66,10 @@ if(ROCPROFSYS_INSTALL_EXAMPLES) COMPONENT rocprofiler-systems-examples) endif() -add_subdirectory(target) +if(ROCPROFSYS_DISABLE_EXAMPLES) + if(NOT "openmp-target" IN_LIST ROCPROFSYS_DISABLE_EXAMPLES) + add_subdirectory(target) + endif() +else() + add_subdirectory(target) +endif()