summaryrefslogtreecommitdiffstats
path: root/Modules/GenerateExportHeader.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2011-08-11 16:17:12 (GMT)
committerStephen Kelly <steveire@gmail.com>2011-08-11 16:17:12 (GMT)
commit9554e1013ef5d9971092ed0cd45daf59b8a6bd87 (patch)
tree586fd50f5b2df1590506a2ebc920ed3395b9a661 /Modules/GenerateExportHeader.cmake
parent1590d5fe4f95a800635ba9078e822d742a96dc18 (diff)
downloadCMake-9554e1013ef5d9971092ed0cd45daf59b8a6bd87.zip
CMake-9554e1013ef5d9971092ed0cd45daf59b8a6bd87.tar.gz
CMake-9554e1013ef5d9971092ed0cd45daf59b8a6bd87.tar.bz2
Split the deprecated available check from setting macro values.
Diffstat (limited to 'Modules/GenerateExportHeader.cmake')
-rw-r--r--Modules/GenerateExportHeader.cmake22
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 92b9433..f690655 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -140,6 +140,20 @@ macro(_test_compiler_hidden_visibility)
endif()
endmacro()
+macro(_test_compiler_has_deprecated)
+ if (WIN32)
+ if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland)
+ set(COMPILER_HAS_DEPRECATED TRUE)
+ endif()
+ else()
+ # TODO: Test properly for this
+ if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+ set(COMPILER_HAS_DEPRECATED TRUE)
+ endif()
+ endif()
+ set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED}" CACHE INTERNAL "Compiler support for a deprecated attribute")
+endmacro()
+
set(myDir ${CMAKE_CURRENT_LIST_DIR})
macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
@@ -149,13 +163,11 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
set(DEFINE_NO_EXPORT)
if(WIN32)
- message("Compiler is ${CMAKE_CXX_COMPILER_ID}")
- if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES Borland)
- message("Deprecation macro enabled.")
+ if (COMPILER_HAS_DEPRECATED)
set(DEFINE_DEPRECATED "__declspec(deprecated)")
endif()
else()
- if(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+ if(COMPILER_HAS_DEPRECATED)
set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
endif()
endif()
@@ -244,6 +256,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
return()
endif()
_test_compiler_hidden_visibility()
+ _test_compiler_has_deprecated()
_do_set_macro_values(${TARGET_LIBRARY})
_do_generate_export_header(${TARGET_LIBRARY} ${ARGN})
endfunction()
@@ -251,6 +264,7 @@ endfunction()
function(add_compiler_export_flags)
_test_compiler_hidden_visibility()
+ _test_compiler_has_deprecated()
if(NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
message(WARNING "Compiler doesn't have hidden visibility")