summaryrefslogtreecommitdiff
path: root/Tests/Module
diff options
context:
space:
mode:
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-12-23 09:30:24 +0100
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-12-23 09:30:24 +0100
commit317dbdb79761ef65e45c7358cfc7571c6afa54ad (patch)
treed6e8d59029aea04ca4a0579fb1c19c3e493af78f /Tests/Module
parent297c63fa65327491a2b50e521b661c5835a19fe4 (diff)
downloadcmake-317dbdb79761ef65e45c7358cfc7571c6afa54ad.tar.gz
cmake-317dbdb79761ef65e45c7358cfc7571c6afa54ad.tar.bz2
cmake-317dbdb79761ef65e45c7358cfc7571c6afa54ad.zip
Imported Upstream version 2.8.12.2upstream/2.8.12.2sandbox/kevinthierry/upstream
Diffstat (limited to 'Tests/Module')
-rw-r--r--Tests/Module/GenerateExportHeader/CMakeLists.txt9
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt13
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h13
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/main.cpp8
-rw-r--r--Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt1
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt17
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/main.cpp9
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h13
10 files changed, 95 insertions, 2 deletions
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt
index 4a5b1cb5a..09f188191 100644
--- a/Tests/Module/GenerateExportHeader/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt
@@ -23,13 +23,13 @@ set( CMAKE_INCLUDE_CURRENT_DIR ON )
macro(TEST_FAIL value msg)
if (${value})
- message (SEND_ERROR "Test fail:" ${msg} ${Out} )
+ message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} )
endif ()
endmacro()
macro(TEST_PASS value msg)
if (NOT ${value})
- message (SEND_ERROR "Test fail:" ${msg} ${Out} )
+ message (SEND_ERROR "Test fail:" "${msg}\n" ${Out} )
endif ()
endmacro()
@@ -141,6 +141,8 @@ endmacro()
include(GenerateExportHeader)
+add_subdirectory(visibility_preset)
+
add_compiler_export_flags()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
@@ -168,6 +170,9 @@ add_subdirectory(lib_shared_and_statictest)
add_subdirectory(override_symbol)
add_subdirectory(nodeprecated)
add_subdirectory(prefix)
+if(NOT BORLAND)
+ add_subdirectory(c_identifier)
+endif()
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang))
# We deliberately call deprecated methods, and test for that elsewhere.
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt b/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt
new file mode 100644
index 000000000..9f8c8efe6
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt
@@ -0,0 +1,13 @@
+project(c_identifier)
+
+set(c_identifier_lib_SRCS
+ c_identifier_class.cpp
+)
+
+add_library(7c-identifier-lib++ SHARED c_identifier_class.cpp)
+
+generate_export_header(7c-identifier-lib++)
+
+add_executable(c_identifier_exe main.cpp)
+
+target_link_libraries(c_identifier_exe 7c-identifier-lib++)
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp
new file mode 100644
index 000000000..d252c8e8f
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp
@@ -0,0 +1,7 @@
+
+#include "c_identifier_class.h"
+
+int CIdentifierClass::someMethod() const
+{
+ return 0;
+}
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h
new file mode 100644
index 000000000..741efdcec
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h
@@ -0,0 +1,13 @@
+
+#ifndef C_IDENTIFIER_CLASS_H
+#define C_IDENTIFIER_CLASS_H
+
+#include "7c-identifier-lib++_export.h"
+
+class _7C_IDENTIFIER_LIB___EXPORT CIdentifierClass
+{
+public:
+ int someMethod() const;
+};
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp
new file mode 100644
index 000000000..68beebb8f
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp
@@ -0,0 +1,8 @@
+
+#include "c_identifier_class.h"
+
+int main(int argc, char **argv)
+{
+ CIdentifierClass cic;
+ return cic.someMethod();
+}
diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
index a5804fcfb..2a97d8f83 100644
--- a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
@@ -8,6 +8,7 @@ macro(shared_build_fail Source Message)
endmacro()
shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported")
+shared_build_pass("return libshared_exported();" "Failed to build exported function.")
# if (COMPILER_HAS_DEPRECATED)
# shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt
new file mode 100644
index 000000000..2571d2224
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+
+if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden")
+ message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
+endif()
+if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden")
+ message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
+endif()
+
+add_library(visibility_preset SHARED visibility_preset.cpp)
+generate_export_header(visibility_preset)
+
+add_executable(visibility_preset_exe main.cpp)
+
+target_link_libraries(visibility_preset_exe visibility_preset)
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp
new file mode 100644
index 000000000..89c397784
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp
@@ -0,0 +1,9 @@
+
+#include "visibility_preset.h"
+
+int main()
+{
+ VisibilityPreset vp;
+ vp.someMethod();
+ return 0;
+}
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp
new file mode 100644
index 000000000..c97dec6e2
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp
@@ -0,0 +1,7 @@
+
+#include "visibility_preset.h"
+
+void VisibilityPreset::someMethod()
+{
+
+}
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h
new file mode 100644
index 000000000..8becbe189
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h
@@ -0,0 +1,13 @@
+
+#ifndef VISIBILITY_PRESET_H
+#define VISIBILITY_PRESET_H
+
+#include "visibility_preset_export.h"
+
+class VISIBILITY_PRESET_EXPORT VisibilityPreset
+{
+public:
+ void someMethod();
+};
+
+#endif