diff --git a/projects/rocprofiler/CMakeLists.txt b/projects/rocprofiler/CMakeLists.txt index 9729b97b07..b3aa0d5bd0 100644 --- a/projects/rocprofiler/CMakeLists.txt +++ b/projects/rocprofiler/CMakeLists.txt @@ -261,8 +261,23 @@ install( option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" ON) if(FILE_REORG_BACKWARD_COMPATIBILITY) + # To enabe/disable #error in wrapper header files + if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR) + if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR}) + set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}" + CACHE STRING "Header wrapper warnings as errors.") + else() + set(ROCM_HEADER_WRAPPER_WERROR "ON" CACHE STRING "Header wrapper warnings as errors.") + endif() + endif() + + if(ROCM_HEADER_WRAPPER_WERROR) + set(deprecated_error 1) + else() + set(deprecated_error 0) + endif() include(rocprofiler-backward-compat.cmake) -endif() +endif() #FILE_REORG_BACKWARD_COMPATIBILITY if(${LIBRARY_TYPE} STREQUAL SHARED) # Packaging directives diff --git a/projects/rocprofiler/rocprofiler-backward-compat.cmake b/projects/rocprofiler/rocprofiler-backward-compat.cmake index a9b4b78278..658aab0d6b 100644 --- a/projects/rocprofiler/rocprofiler-backward-compat.cmake +++ b/projects/rocprofiler/rocprofiler-backward-compat.cmake @@ -52,11 +52,18 @@ function(create_header_template) #ifndef @include_guard@ #define @include_guard@ +#ifndef ROCM_HEADER_WRAPPER_WERROR +#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@ +#endif +#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */ +#error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rocprofiler\" +#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ #if defined(__GNUC__) #error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rocprofiler\" #else #pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rocprofiler\") #endif +#endif /* ROCM_HEADER_WRAPPER_WERROR */ @include_statements@ #endif")