Merge topic 'GenerateExportHeader-Fix-Clang-support-on-Windows'

1e19936320 GenerateExportHeader: Fix Clang support on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Adrien De Coninck <deconinck.adrien@gmail.com>
Merge-request: !8221
This commit is contained in:
Brad King
2023-02-24 13:33:13 +00:00
committed by Kitware Robot
8 changed files with 92 additions and 6 deletions

View File

@@ -293,7 +293,7 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
set(DEFINE_IMPORT)
set(DEFINE_NO_EXPORT)
if (COMPILER_HAS_DEPRECATED_ATTR)
if (COMPILER_HAS_DEPRECATED_ATTR AND NOT WIN32)
set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
elseif(COMPILER_HAS_DEPRECATED)
set(DEFINE_DEPRECATED "__declspec(deprecated)")

View File

@@ -100,7 +100,9 @@ if (WIN32 OR CYGWIN)
set(_platform Win32-Clang)
elseif(MSVC AND COMPILER_HAS_DEPRECATED)
set(_platform Win32)
elseif((MINGW OR CYGWIN) AND COMPILER_HAS_DEPRECATED)
elseif(CYGWIN AND COMPILER_HAS_DEPRECATED)
set(_platform Cygwin)
elseif(MINGW AND COMPILER_HAS_DEPRECATED)
set(_platform MinGW)
else()
set(_platform WinEmpty)

View File

@@ -0,0 +1,42 @@
#ifndef LIBSHARED_EXPORT_H
#define LIBSHARED_EXPORT_H
#ifdef LIBSHARED_STATIC_DEFINE
# define LIBSHARED_EXPORT
# define LIBSHARED_NO_EXPORT
#else
# ifndef LIBSHARED_EXPORT
# ifdef libshared_EXPORTS
/* We are building this library */
# define LIBSHARED_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define LIBSHARED_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef LIBSHARED_NO_EXPORT
# define LIBSHARED_NO_EXPORT
# endif
#endif
#ifndef LIBSHARED_DEPRECATED
# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef LIBSHARED_DEPRECATED_EXPORT
# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
#endif
#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
# endif
#endif
#endif /* LIBSHARED_EXPORT_H */

View File

@@ -0,0 +1,42 @@
#ifndef LIBSTATIC_EXPORT_H
#define LIBSTATIC_EXPORT_H
#ifdef LIBSTATIC_STATIC_DEFINE
# define LIBSTATIC_EXPORT
# define LIBSTATIC_NO_EXPORT
#else
# ifndef LIBSTATIC_EXPORT
# ifdef libstatic_EXPORTS
/* We are building this library */
# define LIBSTATIC_EXPORT
# else
/* We are using this library */
# define LIBSTATIC_EXPORT
# endif
# endif
# ifndef LIBSTATIC_NO_EXPORT
# define LIBSTATIC_NO_EXPORT
# endif
#endif
#ifndef LIBSTATIC_DEPRECATED
# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef LIBSTATIC_DEPRECATED_EXPORT
# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
#endif
#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
# endif
#endif
#endif /* LIBSTATIC_EXPORT_H */

View File

@@ -22,7 +22,7 @@
#endif
#ifndef LIBSHARED_DEPRECATED
# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
# define LIBSHARED_DEPRECATED __declspec(deprecated)
#endif
#ifndef LIBSHARED_DEPRECATED_EXPORT

View File

@@ -22,7 +22,7 @@
#endif
#ifndef LIBSTATIC_DEPRECATED
# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
# define LIBSTATIC_DEPRECATED __declspec(deprecated)
#endif
#ifndef LIBSTATIC_DEPRECATED_EXPORT

View File

@@ -22,7 +22,7 @@
#endif
#ifndef LIBSHARED_DEPRECATED
# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
# define LIBSHARED_DEPRECATED __declspec(deprecated)
#endif
#ifndef LIBSHARED_DEPRECATED_EXPORT

View File

@@ -22,7 +22,7 @@
#endif
#ifndef LIBSTATIC_DEPRECATED
# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
# define LIBSTATIC_DEPRECATED __declspec(deprecated)
#endif
#ifndef LIBSTATIC_DEPRECATED_EXPORT