diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 9dd8f4a2e..0b93941d9 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -155,7 +155,9 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) set(DEFINE_DEPRECATED "__declspec(deprecated)") endif() else() - set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") + if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY) + set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") + endif() endif() get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)