summaryrefslogtreecommitdiffstats
path: root/Tests/Module/GenerateExportHeader/libsharedtest
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2011-07-13 00:13:33 (GMT)
committerStephen Kelly <steveire@gmail.com>2011-08-07 16:33:47 (GMT)
commit30880707c094ac5c0edd85d0857afb6fbae55326 (patch)
tree837b58ac331f34eeefaced63c4c0a71ee59ef69e /Tests/Module/GenerateExportHeader/libsharedtest
parent955d5133ab2f8bca5372e81af544cafdafc31994 (diff)
downloadCMake-30880707c094ac5c0edd85d0857afb6fbae55326.zip
CMake-30880707c094ac5c0edd85d0857afb6fbae55326.tar.gz
CMake-30880707c094ac5c0edd85d0857afb6fbae55326.tar.bz2
Add the GenerateExportMacro with unit tests.
Reviewed-by: Marcus D. Hanwell <marcus.hanwell@kitware.com>
Diffstat (limited to 'Tests/Module/GenerateExportHeader/libsharedtest')
-rw-r--r--Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
new file mode 100644
index 0000000..7a05205
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
@@ -0,0 +1,27 @@
+
+macro(shared_build_pass Source Message)
+ build_pass("libshared.h" "libshared" "libshared" "${Source}" ${Message})
+endmacro()
+
+macro(shared_build_fail Source Message)
+ build_fail("libshared.h" "libshared" "libshared" "${Source}" ${Message})
+endmacro()
+
+shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported")
+
+shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
+if (COMPILER_HAS_HIDDEN_VISIBILITY)
+ shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
+else()
+ # There is no MSVC equivalent to hiding symbols.
+ shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.")
+endif()
+shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.")
+shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.")
+shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.")
+shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.")
+shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.")
+shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
+
+shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.")
+shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.")