summaryrefslogtreecommitdiff
path: root/Tests/SimpleInstallS2
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-02-01 12:53:28 -0500
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-02-01 12:53:28 -0500
commit2106bdc4eca25c37c45d9336fbaef16f4c5eab80 (patch)
treeb5b59f6d67bd3104576f993d45ccad7b98c0660a /Tests/SimpleInstallS2
parent48dc13a6493627731f945d980acc6c9ac2e4bcc1 (diff)
downloadcmake-2106bdc4eca25c37c45d9336fbaef16f4c5eab80.tar.gz
ENH: Add install test
Diffstat (limited to 'Tests/SimpleInstallS2')
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt36
-rw-r--r--Tests/SimpleInstallS2/foo.c6
-rw-r--r--Tests/SimpleInstallS2/foo.h11
-rw-r--r--Tests/SimpleInstallS2/inst.cxx22
-rw-r--r--Tests/SimpleInstallS2/lib1.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib1.h1
-rw-r--r--Tests/SimpleInstallS2/lib2.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib2.h11
-rw-r--r--Tests/SimpleInstallS2/lib3.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib3.h11
10 files changed, 116 insertions, 0 deletions
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
new file mode 100644
index 0000000000..e8a9ba8198
--- /dev/null
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -0,0 +1,36 @@
+PROJECT (TestSimpleInstall)
+
+#SET(EXECUTABLE_OUTPUT_PATH "${TestSimpleInstall_BINARY_DIR}/This is exec path")
+SET(EXECUTABLE_OUTPUT_PATH "${TestSimpleInstall_BINARY_DIR}/ExecPath")
+SET(LIBRARY_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}")
+
+SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
+ADD_LIBRARY(test1 STATIC lib1.cxx)
+ADD_LIBRARY(test2 SHARED lib2.cxx)
+ADD_LIBRARY(test3 MODULE lib3.cxx)
+ADD_EXECUTABLE (SimpleInstall inst.cxx foo.c foo.h)
+TARGET_LINK_LIBRARIES(SimpleInstall test1 test2)
+
+INSTALL_TARGETS(/bin SimpleInstall)
+INSTALL_TARGETS(/lib test1 test2 test3)
+INSTALL_TARGETS(/include lib1.h lib2.h lib3.h)
+
+SET(EXTRA_INSTALL_FLAGS)
+IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
+ FOREACH(build_type Debug Release RelWithDebInfo MinSizeRel)
+ IF(MAKEPROGRAM MATCHES "/build ${build_type}")
+ SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
+ ENDIF(MAKEPROGRAM MATCHES "/build ${build_type}")
+ IF(MAKEPROGRAM MATCHES "- ${build_type}")
+ SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
+ ENDIF(MAKEPROGRAM MATCHES "- ${build_type}")
+ ENDFOREACH(build_type)
+ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio")
+
+ADD_CUSTOM_COMMAND(
+ TARGET SimpleInstall
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -Pcmake_install.cmake ${EXTRA_INSTALL_FLAGS}
+ COMMENT "Install Project"
+ )
diff --git a/Tests/SimpleInstallS2/foo.c b/Tests/SimpleInstallS2/foo.c
new file mode 100644
index 0000000000..5c7c3e6318
--- /dev/null
+++ b/Tests/SimpleInstallS2/foo.c
@@ -0,0 +1,6 @@
+char* foo = "Foo";
+
+int SomeFunctionInFoo(int i)
+{
+ return i + 5;
+}
diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h
new file mode 100644
index 0000000000..bba9022e58
--- /dev/null
+++ b/Tests/SimpleInstallS2/foo.h
@@ -0,0 +1,11 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern char* foo;
+extern int SomeFunctionInFoo(int i);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx
new file mode 100644
index 0000000000..47d73c0a3a
--- /dev/null
+++ b/Tests/SimpleInstallS2/inst.cxx
@@ -0,0 +1,22 @@
+#include "foo.h"
+
+#include "lib1.h"
+#include "lib2.h"
+
+#include <stdio.h>
+
+int main ()
+{
+ if ( Lib1Func() != 2.0 )
+ {
+ printf("Problem with lib1\n");
+ return 1;
+ }
+ if ( Lib2Func() != 1.0 )
+ {
+ printf("Problem with lib2\n");
+ return 1;
+ }
+ printf("Foo: %s\n", foo);
+ return SomeFunctionInFoo(-5);
+}
diff --git a/Tests/SimpleInstallS2/lib1.cxx b/Tests/SimpleInstallS2/lib1.cxx
new file mode 100644
index 0000000000..7aa905205f
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib1.cxx
@@ -0,0 +1,6 @@
+#include "lib1.h"
+
+float Lib1Func()
+{
+ return 2.0;
+}
diff --git a/Tests/SimpleInstallS2/lib1.h b/Tests/SimpleInstallS2/lib1.h
new file mode 100644
index 0000000000..0d64e76bc4
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib1.h
@@ -0,0 +1 @@
+extern float Lib1Func();
diff --git a/Tests/SimpleInstallS2/lib2.cxx b/Tests/SimpleInstallS2/lib2.cxx
new file mode 100644
index 0000000000..dccc48b789
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib2.cxx
@@ -0,0 +1,6 @@
+#include "lib2.h"
+
+float Lib2Func()
+{
+ return 1.0;
+}
diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h
new file mode 100644
index 0000000000..aa94eb2b45
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib2.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 Lib2Func();
diff --git a/Tests/SimpleInstallS2/lib3.cxx b/Tests/SimpleInstallS2/lib3.cxx
new file mode 100644
index 0000000000..da8dbf942c
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib3.cxx
@@ -0,0 +1,6 @@
+#include "lib3.h"
+
+float Lib3Func()
+{
+ return 2.0;
+}
diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h
new file mode 100644
index 0000000000..e5f4c24db4
--- /dev/null
+++ b/Tests/SimpleInstallS2/lib3.h
@@ -0,0 +1,11 @@
+#ifdef _WIN32
+# ifdef testc3_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 Lib3Func();