summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-09-01 19:14:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-09-01 19:14:01 (GMT)
commit482a235bff6d4ebbb2eb8252f6fe4381b91749cb (patch)
tree23f0d5df2eab7148d7cd1b957959c83c0728b427 /Modules
parent28e1dc8fe083bfc73599a03392100914babf8bee (diff)
parent6a6393c905bd5bdddfaf0eb666ee479eed54ec28 (diff)
downloadCMake-482a235bff6d4ebbb2eb8252f6fe4381b91749cb.zip
CMake-482a235bff6d4ebbb2eb8252f6fe4381b91749cb.tar.gz
CMake-482a235bff6d4ebbb2eb8252f6fe4381b91749cb.tar.bz2
Merge topic 'generate_export_header'
6a6393c Don't use a variable name that might be used in other files. 5ca8c56 Fix up verbatim code sections of the dox. 75596e6 Don't start a line with a dash(-) 826374a Remove blank line at the start of the file. 8b9b8e1 Add documentation about the prefix and no_deprecated options. 51bc63a Fix the feature of using a specific prefix for macros. 3449f6b Add quotes in case cmake is installed in a prefix with a space. 36d28f2 Fix Compiler id variable name. 99b2aab Disable the tests for Watcom. 7ac0ab1 Quote paths in case there is a space in one of them. 89108b9 Look for errors reported by PGI too. e0cc024 Add missing NO_EXPORT macro variant. 1b031d1 More consistency in the macro options. 03d60c7 Try to make the macros do almost nothing for Watcom. 6adeda9 Possibly fix configuration test on AIX. e253348 Possibly fix test on HPUX. 32eff0c Test for too-old-intel compilers. 42154ec Fix up the regex command for Intel. a147a06 Add some settings for non-truncation of test output. bf73e75 Hopefully add version extraction for Intel. aa4f0b6 Fix the version extraction regex for clang. a493d1a Test the correct cxx variable. b6ee2ee Comment the test assertion for now a9a8b9e Exclude win32 from hidden visibility checks. afae7a9 Start testing expected values for compiler flags. 1ae3365 Exclude PGI from exports and deprecated. f426496 Exclude cygwin from the hidden visibility feature. f84c7db Don't enable deprecated on old GCC 9672b33 Don't enable deprecated on HP. 10d8c44 Disable testing of deprecated macros. 97392a7d Fixup forgotten part of aed84517c942a4c40f493fcf997cdf6a047349f8 2aeab4f Borland can't do deprecated. c41c68b Try to error on deprecated on Intel and SunCC. aed8451 Test for deprecated attribute before declspec. c448b09 Perform the -Werror test only once. fb88c6e Add some messaging output to make remaining issues findable. 01e9e98 Test -Werror instead of enabling it per compiler. 9aab2aa Expect the tests to pass if hidden visibilty is not enabled. 856bdb3 Don't change the expected build result based on the platform. df4615e Add the COMPILER_HAS_DEPRECATED only if it has a declspec variant 78a6e1c Exclude the XL compiler from the hidden-visibility test. e1f7ee3 Test for compiler features, instead of for specific platforms. 9554e10 Split the deprecated available check from setting macro values. 1590d5f Don't export methods on already exported classes. 750b67c Don't use hidden visibility on non-mingw windows either. 1f3be45 Make sure the hidden visibility variables never get set on MINGW. 399f415 Only set the deprecated attribute if hidden visibilty is enabled. 1c6b41b Remember to surround the other deprecated test in the Borland check. 3f7e036 Export deprecated free methods too. 7fa5592 Add some debug output to narrow down deprecation test issues 7924c1d Another attempt at fixing Borland. 50460ea Fix off-by-not in test for Borland. b443459 Use the correct project name compiletest not compilefail fc3772e Another attempt to fix the tests on Borland. bab4a22 Disable all export macros on Borland. cff9493 Only set the COMPILER_HAS_HIDDEN_VISIBILITY if GCC >= 4.2 af443b8 Set the CMAKE_RUNTIME_OUTPUT_DIRECTORY for windows builds. 61726f8 Only run the failure tests with gcc >= 4.2 002ddf2 Fix typo and tests failing as a result. 4443037 Fix tests with clang. ffaa127 Test expected no-op instead of aborting the build. 6aca0e2 Short-circuit the tests on unsupported compilers. d123bce Add some debug output. 3574b75 Simplify the compiler feature check c7a937b Simplify. We already know we have hidden visibility at this point. 3b188c8 Test for features, not specific compilers. 4718233 Remove the fatal_warnings option which is no longer used. b19911e Add missing licence header. 706ed2b Add a newline at the end of the file. 8963716 Add a newline at the end of the file. def0a54 Handle the case where the user changes the DEFINE_SYMBOL property. 3088070 Add the GenerateExportMacro with unit tests.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake346
-rw-r--r--Modules/exportheader.cmake.in35
3 files changed, 383 insertions, 0 deletions
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index f646e78..3da04b4 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -34,6 +34,8 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
FAIL_REGEX "[Uu]nknown option" # HP
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
FAIL_REGEX "command option .* is not recognized" # XL
+ FAIL_REGEX "not supported in this configuration; ignored" # AIX
+ FAIL_REGEX "File with unknown suffix passed to linker" # PGI
)
SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
ENDMACRO (CHECK_CXX_COMPILER_FLAG)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
new file mode 100644
index 0000000..4eb67b5
--- /dev/null
+++ b/Modules/GenerateExportHeader.cmake
@@ -0,0 +1,346 @@
+# - Function for generation of export macros for libraries
+# This module provides the function GENERATE_EXPORT_HEADER() and the
+# accompanying ADD_COMPILER_EXPORT_FLAGS() function.
+#
+# The GENERATE_EXPORT_HEADER function can be used to generate a file suitable
+# for preprocessor inclusion which contains EXPORT macros to be used in
+# library classes.
+#
+# GENERATE_EXPORT_HEADER( LIBRARY_TARGET
+# [BASE_NAME <base_name>]
+# [EXPORT_MACRO_NAME <export_macro_name>]
+# [EXPORT_FILE_NAME <export_file_name>]
+# [DEPRECATED_MACRO_NAME <deprecated_macro_name>]
+# [NO_EXPORT_MACRO_NAME <no_export_macro_name>]
+# [STATIC_DEFINE <static_define>]
+# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
+# [DEFINE_NO_DEPRECATED]
+# [PREFIX_NAME <prefix_name>]
+# )
+#
+# ADD_COMPILER_EXPORT_FLAGS( [FATAL_WARNINGS] )
+#
+# By default GENERATE_EXPORT_HEADER() generates macro names in a file name
+# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS macro
+# 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.
+#
+# This means that in the simplest case, users of these functions will be equivalent to:
+#
+# add_compiler_export_flags()
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib)
+# install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR})
+# install(FILES
+# someclass.h
+# ${PROJECT_BINARY_DIR}/somelib_export.h DESTINATION ${INCLUDE_INSTALL_DIR}
+# )
+#
+# And in the ABI header files:
+#
+# #include "somelib_export.h"
+# class SOMELIB_EXPORT SomeClass {
+# ...
+# };
+#
+# The CMake fragment will generate a file in the ${CMAKE_CURRENT_BUILD_DIR} called
+# somelib_export.h containing the macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT,
+# SOMELIB_DEPRECATED, SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT.
+# The resulting file should be installed with other headers in the library.
+#
+# The BASE_NAME argument can be used to override the file name and the names
+# used for the macros
+#
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib
+# BASE_NAME other_name
+# )
+#
+# Generates a file called other_name_export.h containing the macros
+# OTHER_NAME_EXPORT, OTHER_NAME_NO_EXPORT and OTHER_NAME_DEPRECATED etc.
+#
+# The BASE_NAME may be overridden by specifiying other options in the function.
+# For example:
+#
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib
+# EXPORT_MACRO_NAME OTHER_NAME_EXPORT
+# )
+#
+# creates the macro OTHER_NAME_EXPORT instead of SOMELIB_EXPORT, but other macros
+# and the generated file name is as default.
+#
+# add_library(somelib someclass.cpp)
+# generate_export_header(somelib
+# DEPRECATED_MACRO_NAME KDE_DEPRECATED
+# )
+#
+# creates the macro KDE_DEPRECATED instead of SOMELIB_DEPRECATED.
+#
+# If LIBRARY_TARGET is a static library, macros are defined without values.
+#
+# If the same sources are used to create both a shared and a static library, the
+# uppercased symbol ${BASE_NAME}_STATIC_DEFINE should be used when building the
+# static library
+#
+# add_library(shared_variant SHARED ${lib_SRCS})
+# add_library(static_variant ${lib_SRCS})
+# generate_export_header(shared_variant BASE_NAME libshared_and_static)
+# set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
+#
+# This will cause the export macros to expand to nothing when building the static library.
+#
+# If DEFINE_NO_DEPRECATED is specified, then a macro ${BASE_NAME}_NO_DEPRECATED will be defined
+# This macro can be used to remove deprecated code from preprocessor output.
+#
+# option(EXCLUDE_DEPRECATED "Exclude deprecated parts of the library" FALSE)
+# if (EXCLUDE_DEPRECATED)
+# set(NO_BUILD_DEPRECATED DEFINE_NO_DEPRECATED)
+# endif()
+# generate_export_header(somelib ${NO_BUILD_DEPRECATED})
+#
+# And then in somelib:
+#
+# class SOMELIB_EXPORT SomeClass
+# {
+# public:
+# #ifndef SOMELIB_NO_DEPRECATED
+# SOMELIB_DEPRECATED void oldMethod();
+# #endif
+# };
+#
+# #ifndef SOMELIB_NO_DEPRECATED
+# void SomeClass::oldMethod() { }
+# #endif
+#
+# If PREFIX_NAME is specified, the argument will be used as a prefix to all
+# generated macros.
+#
+# For example:
+#
+# generate_export_header(somelib PREFIX_NAME VTK_)
+#
+# Generates the macros VTK_SOMELIB_EXPORT etc.
+
+
+#=============================================================================
+# Copyright 2011 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(CMakeParseArguments)
+include(CheckCXXCompilerFlag)
+
+
+# TODO: Install this macro separately?
+macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT)
+ check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT}
+ # Some compilers do not fail with a bad flag
+ FAIL_REGEX "unrecognized .*option" # GNU
+ FAIL_REGEX "ignoring unknown option" # MSVC
+ FAIL_REGEX "warning D9002" # MSVC, any lang
+ FAIL_REGEX "[Uu]nknown option" # HP
+ FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
+ FAIL_REGEX "command option .* is not recognized" # XL
+ )
+endmacro()
+
+macro(_test_compiler_hidden_visibility)
+
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
+ string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+ # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
+ # patch level, handle this here:
+ if(NOT _gcc_version)
+ string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+ endif()
+
+ if(${_gcc_version} VERSION_LESS "4.2")
+ set(GCC_TOO_OLD TRUE)
+ message(WARNING "GCC version older than 4.2")
+ endif()
+ endif()
+
+ if(CMAKE_CXX_COMPILER_ID MATCHES Intel)
+ exec_program(${CMAKE_CXX_COMPILER} ARGS -V OUTPUT_VARIABLE _intel_version_info)
+ string (REGEX REPLACE ".*Version ([0-9]+(\\.[0-9]+)+).*" "\\1" _intel_version "${_intel_version_info}")
+
+ if(${_intel_version} VERSION_LESS "12.0")
+ set(_INTEL_TOO_OLD TRUE)
+ message(WARNING "Intel compiler older than 12.0")
+ endif()
+ endif()
+
+
+ # Exclude XL here because it misinterprets -fvisibility=hidden even though
+ # the check_cxx_compiler_flag passes
+ # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259
+ if (NOT GCC_TOO_OLD
+ AND NOT _INTEL_TOO_OLD
+ AND NOT WIN32
+ AND NOT CYGWIN
+ AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
+ AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
+ AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+ check_cxx_compiler_flag(-fvisibility-inlines-hidden COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
+ option(USE_COMPILER_HIDDEN_VISIBILITY "Use HIDDEN visibility support if available." ON)
+ mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
+ endif()
+endmacro()
+
+macro(_test_compiler_has_deprecated)
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES Borland
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES HP
+ OR GCC_TOO_OLD
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL "Compiler support for a deprecated attribute")
+ else()
+ _check_cxx_compiler_attribute("__attribute__((__deprecated__))" COMPILER_HAS_DEPRECATED_ATTR)
+ if(COMPILER_HAS_DEPRECATED_ATTR)
+ set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" CACHE INTERNAL "Compiler support for a deprecated attribute")
+ else()
+ _check_cxx_compiler_attribute("__declspec(deprecated)" COMPILER_HAS_DEPRECATED)
+ endif()
+ endif()
+endmacro()
+
+get_filename_component(_GENERATE_EXPORT_HEADER_MODULE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
+ set(DEFINE_DEPRECATED)
+ set(DEFINE_EXPORT)
+ set(DEFINE_IMPORT)
+ set(DEFINE_NO_EXPORT)
+
+ if (COMPILER_HAS_DEPRECATED_ATTR)
+ set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
+ elseif(COMPILER_HAS_DEPRECATED)
+ set(DEFINE_DEPRECATED "__declspec(deprecated)")
+ endif()
+
+ get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
+
+ if(NOT ${type} STREQUAL "STATIC_LIBRARY")
+ if(WIN32)
+ set(DEFINE_EXPORT "__declspec(dllexport)")
+ set(DEFINE_IMPORT "__declspec(dllimport)")
+ elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+ set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))")
+ set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))")
+ set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))")
+ endif()
+ endif()
+endmacro()
+
+macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
+ # Option overrides
+ set(options DEFINE_NO_DEPRECATED)
+ set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE NO_DEPRECATED_MACRO_NAME)
+ set(multiValueArgs)
+
+ cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ set(BASE_NAME "${TARGET_LIBRARY}")
+
+ if(_GEH_BASE_NAME)
+ set(BASE_NAME ${_GEH_BASE_NAME})
+ endif()
+
+ string(TOUPPER ${BASE_NAME} BASE_NAME_UPPER)
+ string(TOLOWER ${BASE_NAME} BASE_NAME_LOWER)
+
+ # Default options
+ set(EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_EXPORT")
+ set(NO_EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_EXPORT")
+ set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME_LOWER}_export.h")
+ set(DEPRECATED_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_DEPRECATED")
+ set(STATIC_DEFINE "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_STATIC_DEFINE")
+ set(NO_DEPRECATED_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_DEPRECATED")
+
+ if(_GEH_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown keywords given to GENERATE_EXPORT_HEADER(): \"${_GEH_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if(_GEH_EXPORT_MACRO_NAME)
+ set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME})
+ endif()
+ if(_GEH_EXPORT_FILE_NAME)
+ if(IS_ABSOLUTE _GEH_EXPORT_FILE_NAME)
+ set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME})
+ else()
+ set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${_GEH_EXPORT_FILE_NAME}")
+ endif()
+ endif()
+ if(_GEH_DEPRECATED_MACRO_NAME)
+ set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME})
+ endif()
+ if(_GEH_NO_EXPORT_MACRO_NAME)
+ set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME})
+ endif()
+ if(_GEH_STATIC_DEFINE)
+ set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE})
+ endif()
+
+ if (_GEH_DEFINE_NO_DEPRECATED)
+ set(DEFINE_NO_DEPRECATED TRUE)
+ endif()
+
+ if (_GEH_NO_DEPRECATED_MACRO_NAME)
+ set(NO_DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME})
+ endif()
+
+ set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
+
+ get_target_property(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY} DEFINE_SYMBOL)
+
+ if (NOT EXPORT_IMPORT_CONDITION)
+ set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS)
+ endif()
+
+ configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in" "${EXPORT_FILE_NAME}" @ONLY)
+endmacro()
+
+function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
+ get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
+ if(${type} STREQUAL "MODULE")
+ message(WARNING "This macro should not be used with libraries of type MODULE")
+ return()
+ endif()
+ if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY")
+ message(WARNING "This macro can only be used with libraries")
+ return()
+ endif()
+ _test_compiler_hidden_visibility()
+ _test_compiler_has_deprecated()
+ _do_set_macro_values(${TARGET_LIBRARY})
+ _do_generate_export_header(${TARGET_LIBRARY} ${ARGN})
+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")
+ return()
+ endif()
+
+ set (EXTRA_FLAGS "-fvisibility=hidden")
+
+ if(COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
+ set (EXTRA_FLAGS "${EXTRA_FLAGS} -fvisibility-inlines-hidden")
+ endif()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
+endfunction()
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
new file mode 100644
index 0000000..131d3a7
--- /dev/null
+++ b/Modules/exportheader.cmake.in
@@ -0,0 +1,35 @@
+
+#ifndef @INCLUDE_GUARD_NAME@
+#define @INCLUDE_GUARD_NAME@
+
+#ifdef @STATIC_DEFINE@
+# define @EXPORT_MACRO_NAME@
+# define @NO_EXPORT_MACRO_NAME@
+#else
+# ifndef @EXPORT_MACRO_NAME@
+# ifdef @EXPORT_IMPORT_CONDITION@
+ /* We are building this library */
+# define @EXPORT_MACRO_NAME@ @DEFINE_EXPORT@
+# else
+ /* We are using this library */
+# define @EXPORT_MACRO_NAME@ @DEFINE_IMPORT@
+# endif
+# endif
+
+# ifndef @NO_EXPORT_MACRO_NAME@
+# define @NO_EXPORT_MACRO_NAME@ @DEFINE_NO_EXPORT@
+# endif
+#endif
+
+#ifndef @DEPRECATED_MACRO_NAME@
+# define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@
+# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
+# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
+#endif
+
+#cmakedefine01 DEFINE_NO_DEPRECATED
+#if DEFINE_NO_DEPRECATED
+# define @NO_DEPRECATED_MACRO_NAME@
+#endif
+
+#endif // @INCLUDE_GUARD_NAME@