summaryrefslogtreecommitdiff
path: root/Tests/COnly
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/COnly')
-rw-r--r--Tests/COnly/CMakeLists.txt23
-rw-r--r--Tests/COnly/conly.c23
-rw-r--r--Tests/COnly/foo.c1
-rw-r--r--Tests/COnly/foo.h1
-rw-r--r--Tests/COnly/libc1.c4
-rw-r--r--Tests/COnly/libc1.h1
-rw-r--r--Tests/COnly/libc2.c6
-rw-r--r--Tests/COnly/libc2.h11
-rw-r--r--Tests/COnly/testCModule.c6
9 files changed, 76 insertions, 0 deletions
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt
new file mode 100644
index 000000000..5ef0f1eea
--- /dev/null
+++ b/Tests/COnly/CMakeLists.txt
@@ -0,0 +1,23 @@
+# a simple C only test case
+cmake_minimum_required (VERSION 2.6)
+project (COnly C)
+
+set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
+add_library(testc1 STATIC libc1.c)
+add_library(testc2 SHARED libc2.c)
+add_executable (COnly conly.c foo.c foo.h)
+target_link_libraries(COnly testc1 testc2)
+if(MSVC_VERSION)
+ set_target_properties(COnly PROPERTIES
+ LINK_FLAGS " /NODEFAULTLIB:\"libcdg.lib\" /NODEFAULTLIB:\"libcmtg.lib\" /NODEFAULTLIB:\"foomsvcrt.lib\" /NODEFAULTLIB:\"libbar.lib\" /NODEFAULTLIB:\"libfooba.lib\"")
+endif(MSVC_VERSION)
+string(ASCII 35 32 67 77 97 107 101 ASCII_STRING)
+message(STATUS "String: ${ASCII_STRING}")
+get_source_file_property(LANG conly.c LANGUAGE)
+if("${LANG}" STREQUAL "C")
+ message("Language is C")
+else("${LANG}" STREQUAL "C")
+ message(FATAL_ERROR "Bad language for file conly.c")
+endif("${LANG}" STREQUAL "C")
+
+add_library(testCModule MODULE testCModule.c)
diff --git a/Tests/COnly/conly.c b/Tests/COnly/conly.c
new file mode 100644
index 000000000..7214fe1bc
--- /dev/null
+++ b/Tests/COnly/conly.c
@@ -0,0 +1,23 @@
+#include "foo.h"
+
+#include "libc1.h"
+#include "libc2.h"
+
+#include <stdio.h>
+
+int main ()
+{
+ int class = 0;
+ if ( LibC1Func() != 2.0 )
+ {
+ printf("Problem with libc1\n");
+ return 1;
+ }
+ if ( LibC2Func() != 1.0 )
+ {
+ printf("Problem with libc2\n");
+ return 1;
+ }
+ printf("Foo: %s %d\n", foo, class);
+ return 0;
+}
diff --git a/Tests/COnly/foo.c b/Tests/COnly/foo.c
new file mode 100644
index 000000000..e4faf38a3
--- /dev/null
+++ b/Tests/COnly/foo.c
@@ -0,0 +1 @@
+char* foo = "Foo";
diff --git a/Tests/COnly/foo.h b/Tests/COnly/foo.h
new file mode 100644
index 000000000..ad4a9af0f
--- /dev/null
+++ b/Tests/COnly/foo.h
@@ -0,0 +1 @@
+extern char* foo;
diff --git a/Tests/COnly/libc1.c b/Tests/COnly/libc1.c
new file mode 100644
index 000000000..b01e1e1b5
--- /dev/null
+++ b/Tests/COnly/libc1.c
@@ -0,0 +1,4 @@
+float LibC1Func()
+{
+ return 2.0;
+}
diff --git a/Tests/COnly/libc1.h b/Tests/COnly/libc1.h
new file mode 100644
index 000000000..84c94a9cb
--- /dev/null
+++ b/Tests/COnly/libc1.h
@@ -0,0 +1 @@
+extern float LibC1Func();
diff --git a/Tests/COnly/libc2.c b/Tests/COnly/libc2.c
new file mode 100644
index 000000000..0fd895664
--- /dev/null
+++ b/Tests/COnly/libc2.c
@@ -0,0 +1,6 @@
+#include "libc2.h"
+
+float LibC2Func()
+{
+ return 1.0;
+}
diff --git a/Tests/COnly/libc2.h b/Tests/COnly/libc2.h
new file mode 100644
index 000000000..a99d8984e
--- /dev/null
+++ b/Tests/COnly/libc2.h
@@ -0,0 +1,11 @@
+#ifdef _WIN32
+# ifdef testc2_EXPORTS
+# define CM_TEST_LIB_EXPORT __declspec( dllexport )
+# else
+# define CM_TEST_LIB_EXPORT __declspec( dllimport )
+# endif
+#else
+# define CM_TEST_LIB_EXPORT
+#endif
+
+CM_TEST_LIB_EXPORT float LibC2Func();
diff --git a/Tests/COnly/testCModule.c b/Tests/COnly/testCModule.c
new file mode 100644
index 000000000..1a89292b3
--- /dev/null
+++ b/Tests/COnly/testCModule.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+# define TEST_EXPORT __declspec(dllexport)
+#else
+# define TEST_EXPORT
+#endif
+TEST_EXPORT int testCModule(void) { return 0; }