diff options
author | Brad King <brad.king@kitware.com> | 2013-10-07 19:42:41 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-07 19:42:41 (GMT) |
commit | e0c7ccb1b32f9df6510f1dd9b8320be1e3b7babb (patch) | |
tree | 7607f1c4196b9088c1ce5d3482a7d5a7cd5d4547 /Modules | |
parent | 1c49ecad36062139852decd0632145a2d461688f (diff) | |
parent | 0f3a66673f9333b37df29c2bd37969c418628ac0 (diff) | |
download | CMake-e0c7ccb1b32f9df6510f1dd9b8320be1e3b7babb.zip CMake-e0c7ccb1b32f9df6510f1dd9b8320be1e3b7babb.tar.gz CMake-e0c7ccb1b32f9df6510f1dd9b8320be1e3b7babb.tar.bz2 |
Merge topic 'deprecate-add_compiler_export_flags'
0f3a666 GenerateExportHeader: Deprecate add_compiler_export_flags function.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/GenerateExportHeader.cmake | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 4ef14ac..b2fda09 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -1,6 +1,5 @@ # - Function for generation of export macros for libraries -# This module provides the function GENERATE_EXPORT_HEADER() and the -# accompanying ADD_COMPILER_EXPORT_FLAGS() function. +# This module provides the function GENERATE_EXPORT_HEADER(). # # The GENERATE_EXPORT_HEADER function can be used to generate a file suitable # for preprocessor inclusion which contains EXPORT macros to be used in @@ -18,20 +17,17 @@ # [PREFIX_NAME <prefix_name>] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN +# can be used to add the appropriate compile flags for targets. See the +# documentation of those target properties, and the convenience variables +# CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN. # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name -# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function -# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on -# Windows which does not need extra compiler flags for exporting support. You -# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will -# be populated with the required CXX_FLAGS required to enable visibility support -# for the compiler/architecture in use. +# determined by the name of the library. This means that in the simplest case, +# users of generate_export_header will be equivalent to: # -# This means that in the simplest case, users of these functions will be -# equivalent to: -# -# add_compiler_export_flags() +# set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # add_library(somelib someclass.cpp) # generate_export_header(somelib) # install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR}) @@ -128,6 +124,20 @@ # generate_export_header(somelib PREFIX_NAME VTK_) # # Generates the macros VTK_SOMELIB_EXPORT etc. +# +# +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# +# The ADD_COMPILER_EXPORT_FLAGS function +# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on +# Windows which does not need extra compiler flags for exporting support. You +# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will +# be populated with the required CXX_FLAGS required to enable visibility support +# for the compiler/architecture in use. +# +# This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET +# and VISIBILITY_INLINES_HIDDEN instead. +# #============================================================================= # Copyright 2011 Stephen Kelly <steveire@gmail.com> @@ -326,6 +336,17 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) endfunction() function(add_compiler_export_flags) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") + endif() + endif() _test_compiler_hidden_visibility() _test_compiler_has_deprecated() |