summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/GenerateExportHeader
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2016-09-02 11:23:16 -0400
committerBrad King <brad.king@kitware.com>2016-09-12 10:28:59 -0400
commitce76abb4c49a85d491a99318637c6e9e37729f6e (patch)
tree5ca1b142e9f6b40867c239f18ddda3588c3cf5ec /Tests/RunCMake/GenerateExportHeader
parent8f95b93b41622d428522ae10cfe1bc2fde13c78c (diff)
downloadcmake-ce76abb4c49a85d491a99318637c6e9e37729f6e.tar.gz
Tests: Add data symbols to GenerateExportHeader test
Add static data members and global variables to the GenerateExportHeader shared library, testing that export decoration for these works in addition to decoration of classes and free functions.
Diffstat (limited to 'Tests/RunCMake/GenerateExportHeader')
-rw-r--r--Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp20
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp28
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libshared/libshared.h26
3 files changed, 74 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
index 3a4e7dd364..fc6cceb24d 100644
--- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
@@ -66,6 +66,14 @@ int main()
#else
// l.libshared_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN)
#endif
+
+ use_int(l.data_exported);
+ use_int(l.data_not_exported);
+#if defined(_WIN32) || defined(__CYGWIN__)
+ use_int(l.data_excluded);
+#else
+// use_int(l.data_excluded); LINK ERROR (NOT WIN32 AND NOT CYGWIN)
+#endif
}
{
@@ -75,6 +83,10 @@ int main()
l.libshared_deprecated();
// l.libshared_not_exported(); LINK ERROR
// l.libshared_excluded(); LINK ERROR
+
+ use_int(l.data_exported);
+ // use_int(l.data_not_exported); LINK ERROR
+ // use_int(l.data_excluded); LINK ERROR
}
{
@@ -84,6 +96,10 @@ int main()
l.libshared_deprecated();
// l.libshared_not_exported(); LINK ERROR
// l.libshared_excluded(); LINK ERROR
+
+ use_int(l.data_exported);
+ // use_int(l.data_not_exported); LINK ERROR
+ // use_int(l.data_excluded); LINK ERROR
}
libshared_exported();
@@ -91,6 +107,10 @@ int main()
// libshared_not_exported(); LINK ERROR
// libshared_excluded(); LINK ERROR
+ use_int(data_exported);
+ // use_int(data_not_exported); LINK ERROR
+ // use_int(data_excluded); LINK ERROR
+
{
Libstatic l;
l.libstatic();
diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
index ad6d3564ba..7e46ab5760 100644
--- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
@@ -26,6 +26,12 @@ int Libshared::libshared_excluded() const
return 0;
}
+int const Libshared::data_exported = 1;
+
+int const Libshared::data_not_exported = 1;
+
+int const Libshared::data_excluded = 1;
+
int LibsharedNotExported::libshared() const
{
return 0;
@@ -51,6 +57,12 @@ int LibsharedNotExported::libshared_excluded() const
return 0;
}
+int const LibsharedNotExported::data_exported = 1;
+
+int const LibsharedNotExported::data_not_exported = 1;
+
+int const LibsharedNotExported::data_excluded = 1;
+
int LibsharedExcluded::libshared() const
{
return 0;
@@ -76,6 +88,12 @@ int LibsharedExcluded::libshared_excluded() const
return 0;
}
+int const LibsharedExcluded::data_exported = 1;
+
+int const LibsharedExcluded::data_not_exported = 1;
+
+int const LibsharedExcluded::data_excluded = 1;
+
int libshared()
{
return 0;
@@ -100,3 +118,13 @@ int libshared_excluded()
{
return 0;
}
+
+int const data_exported = 1;
+
+int const data_not_exported = 1;
+
+int const data_excluded = 1;
+
+void use_int(int)
+{
+}
diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
index bd9f2e3694..62879c2b85 100644
--- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
+++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
@@ -16,6 +16,12 @@ public:
int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() const;
+
+ static int const LIBSHARED_EXPORT data_exported;
+
+ static int const data_not_exported;
+
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
class LibsharedNotExported
@@ -30,6 +36,12 @@ public:
int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() const;
+
+ static int const LIBSHARED_EXPORT data_exported;
+
+ static int const data_not_exported;
+
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
class LIBSHARED_NO_EXPORT LibsharedExcluded
@@ -44,6 +56,12 @@ public:
int libshared_not_exported() const;
int LIBSHARED_NO_EXPORT libshared_excluded() const;
+
+ static int const LIBSHARED_EXPORT data_exported;
+
+ static int const data_not_exported;
+
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
LIBSHARED_EXPORT int libshared_exported();
@@ -54,4 +72,12 @@ int libshared_not_exported();
int LIBSHARED_NO_EXPORT libshared_excluded();
+extern int const LIBSHARED_EXPORT data_exported;
+
+extern int const data_not_exported;
+
+extern int const LIBSHARED_NO_EXPORT data_excluded;
+
+LIBSHARED_EXPORT void use_int(int);
+
#endif