From 8a33068afe80b029466f9bf8afba4214979dc23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Date: Mon, 10 Jun 2024 20:17:40 -0700 Subject: [PATCH] visibility: add support for Oracle Developer Studio 12.6 While an `-fvisibility` flag was added in the previous version, it throws warnings indicating it would be ignored unless given to the linker and fails to work properly. Tested on Solaris 11.3 SPARC and Solaris 11.4 x86/SPARC. --- Modules/Compiler/SunPro-C.cmake | 4 ++++ Modules/Compiler/SunPro-CXX.cmake | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 7b4478ce45..35dbdcd5a8 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -65,5 +65,9 @@ endif() __compiler_check_default_language_standard(C 5.11 90 5.14 11) +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.15) + set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") +endif() + set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 1db6aa7fcd..33ce9fc11d 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -69,3 +69,7 @@ else() endif() __compiler_check_default_language_standard(CXX 1 98) + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.15) + set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") +endif()