From dad6e94417191f947da0f5ba2342ff7721efa6e4 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 3 Jul 2025 14:19:35 +0200 Subject: [PATCH] Error out when `LIBOMPTARGET_OMPT_SUPPORT` is requested but not supported Currently a user could pass `-DLIBOMPTARGET_OMPT_SUPPORT=ON` but the build may ignore it There is already a check for `LIBOMP_OMPT_SUPPORT AND NOT LIBOMP_HAVE_OMPT_SUPPORT` causing an error so a) There should be a similar error on mismatch of passed options and supported configuration b) The check for `LIBOMP_HAVE_OMPT_SUPPORT` is redundant --- offload/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt index 0a441c3bc5782..f5c39e9ebf4a3 100644 --- a/offload/CMakeLists.txt +++ b/offload/CMakeLists.txt @@ -326,15 +326,17 @@ endmacro() # OMPT support for libomptarget # Follow host OMPT support and check if host support has been requested. -# LIBOMP_HAVE_OMPT_SUPPORT indicates whether host OMPT support has been implemented. # LIBOMP_OMPT_SUPPORT indicates whether host OMPT support has been requested (default is ON). -# LIBOMPTARGET_OMPT_SUPPORT indicates whether target OMPT support has been requested (default is ON). set(OMPT_TARGET_DEFAULT FALSE) -if ((LIBOMP_HAVE_OMPT_SUPPORT) AND (LIBOMP_OMPT_SUPPORT) AND (NOT WIN32)) +if (LIBOMP_OMPT_SUPPORT AND (NOT WIN32)) set (OMPT_TARGET_DEFAULT TRUE) endif() +# LIBOMPTARGET_OMPT_SUPPORT indicates whether target OMPT support has been requested. set(LIBOMPTARGET_OMPT_SUPPORT ${OMPT_TARGET_DEFAULT} CACHE BOOL "OMPT-target-support?") -if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT)) +if (LIBOMPTARGET_OMPT_SUPPORT) + if(NOT LIBOMP_OMPT_SUPPORT) + message(FATAL_ERROR "OMPT Target support requested but OMPT (host) support is not enabled") + endif() add_definitions(-DOMPT_SUPPORT=1) message(STATUS "OMPT target enabled") else()