summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenerateExportHeader/nodeprecated
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/GenerateExportHeader/nodeprecated')
-rw-r--r--Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt26
-rw-r--r--Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in15
-rw-r--r--Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp9
-rw-r--r--Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp8
-rw-r--r--Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h10
5 files changed, 68 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt
new file mode 100644
index 0000000..aeeb13a
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(nodeprecated)
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined)
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined)
+
+configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined/CMakeLists.txt)
+set(DEFINE_NO_DEPRECATED DEFINE_NO_DEPRECATED)
+configure_file(CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined/CMakeLists.txt)
+
+try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined_build
+ ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined
+ nodeprecated_test
+ OUTPUT_VARIABLE Out
+)
+
+test_pass(Result "Failed to build without no-deprecated define")
+
+try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined_build
+ ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined
+ nodeprecated_test
+ OUTPUT_VARIABLE Out
+)
+
+test_fail(Result "Built even with no-deprecated define") \ No newline at end of file
diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in
new file mode 100644
index 0000000..d8dc482
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/CMakeLists.txt.in
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(nodeprecated_test)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+include(GenerateExportHeader)
+
+add_library(nodeprecatedlib SHARED someclass.cpp)
+
+generate_export_header(nodeprecatedlib @DEFINE_NO_DEPRECATED@)
+
+add_executable(nodeprecatedconsumer main.cpp)
+
+target_link_libraries(nodeprecatedconsumer nodeprecatedlib)
diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp
new file mode 100644
index 0000000..eec46d3
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/main.cpp
@@ -0,0 +1,9 @@
+
+#include "someclass.h"
+
+int main(int, char**)
+{
+ SomeClass sc;
+ sc.someMethod();
+ return 0;
+}
diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp
new file mode 100644
index 0000000..81dce62
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.cpp
@@ -0,0 +1,8 @@
+
+#include "someclass.h"
+
+#ifndef NODEPRECATEDLIB_NO_DEPRECATED
+void SomeClass::someMethod() const
+{
+}
+#endif
diff --git a/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h
new file mode 100644
index 0000000..312a177
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/nodeprecated/src/someclass.h
@@ -0,0 +1,10 @@
+
+#include "nodeprecatedlib_export.h"
+
+class NODEPRECATEDLIB_EXPORT SomeClass
+{
+public:
+#ifndef NODEPRECATEDLIB_NO_DEPRECATED
+ void someMethod() const;
+#endif
+};