summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CMakeLists.txt22
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt36
-rw-r--r--Tests/SimpleInstall/foo.c6
-rw-r--r--Tests/SimpleInstall/foo.h11
-rw-r--r--Tests/SimpleInstall/inst.cxx22
-rw-r--r--Tests/SimpleInstall/lib1.cxx6
-rw-r--r--Tests/SimpleInstall/lib1.h1
-rw-r--r--Tests/SimpleInstall/lib2.cxx6
-rw-r--r--Tests/SimpleInstall/lib2.h11
-rw-r--r--Tests/SimpleInstall/lib3.cxx6
-rw-r--r--Tests/SimpleInstall/lib3.h11
-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
21 files changed, 250 insertions, 4 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 41191e9..5a8aad2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -238,6 +238,20 @@ IF(BUILD_TESTING)
--build-two-config
--test-command conly)
+ SET(SimpleInstallInstallDir
+ "${CMake_BINARY_DIR}/Tests/SimpleInstall/Install Directory")
+ ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
+ "${CMake_BINARY_DIR}/Tests/SimpleInstall"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-project TestSimpleInstall
+ --build-makeprogram ${MAKEPROGRAM}
+ --build-two-config
+ --build-options
+ "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
+ --test-command ${SimpleInstallInstallDir}/bin/SimpleInstall)
+
ADD_TEST(X11 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/X11"
@@ -554,14 +568,14 @@ IF(BUILD_TESTING)
ENDIF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR)
IF(UNIX)
- IF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${CMake_BINARY_DIR}/Tests/TestInstall/Prefix$")
+ IF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix$")
CONFIGURE_FILE(
${CMake_SOURCE_DIR}/Tests/TestInstall.sh.in
- ${CMake_BINARY_DIR}/Tests/TestInstall/TestInstall.sh
+ ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestInstall.sh
@ONLY IMMEDIATE
)
- ADD_TEST(Install /bin/sh ${CMake_BINARY_DIR}/Tests/TestInstall/TestInstall.sh)
- ENDIF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${CMake_BINARY_DIR}/Tests/TestInstall/Prefix$")
+ ADD_TEST(ShellInstall /bin/sh ${CMake_BINARY_DIR}/Tests/TestShellInstall/TestShellInstall.sh)
+ ENDIF("x${CMAKE_INSTALL_PREFIX}" MATCHES "^x${CMake_BINARY_DIR}/Tests/TestShellInstall/Prefix$")
ENDIF(UNIX)
ENDIF(BUILD_TESTING)
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
new file mode 100644
index 0000000..e8a9ba8
--- /dev/null
+++ b/Tests/SimpleInstall/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/SimpleInstall/foo.c b/Tests/SimpleInstall/foo.c
new file mode 100644
index 0000000..5c7c3e6
--- /dev/null
+++ b/Tests/SimpleInstall/foo.c
@@ -0,0 +1,6 @@
+char* foo = "Foo";
+
+int SomeFunctionInFoo(int i)
+{
+ return i + 5;
+}
diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h
new file mode 100644
index 0000000..bba9022
--- /dev/null
+++ b/Tests/SimpleInstall/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/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx
new file mode 100644
index 0000000..47d73c0
--- /dev/null
+++ b/Tests/SimpleInstall/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/SimpleInstall/lib1.cxx b/Tests/SimpleInstall/lib1.cxx
new file mode 100644
index 0000000..7aa9052
--- /dev/null
+++ b/Tests/SimpleInstall/lib1.cxx
@@ -0,0 +1,6 @@
+#include "lib1.h"
+
+float Lib1Func()
+{
+ return 2.0;
+}
diff --git a/Tests/SimpleInstall/lib1.h b/Tests/SimpleInstall/lib1.h
new file mode 100644
index 0000000..0d64e76
--- /dev/null
+++ b/Tests/SimpleInstall/lib1.h
@@ -0,0 +1 @@
+extern float Lib1Func();
diff --git a/Tests/SimpleInstall/lib2.cxx b/Tests/SimpleInstall/lib2.cxx
new file mode 100644
index 0000000..dccc48b
--- /dev/null
+++ b/Tests/SimpleInstall/lib2.cxx
@@ -0,0 +1,6 @@
+#include "lib2.h"
+
+float Lib2Func()
+{
+ return 1.0;
+}
diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h
new file mode 100644
index 0000000..aa94eb2
--- /dev/null
+++ b/Tests/SimpleInstall/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/SimpleInstall/lib3.cxx b/Tests/SimpleInstall/lib3.cxx
new file mode 100644
index 0000000..da8dbf9
--- /dev/null
+++ b/Tests/SimpleInstall/lib3.cxx
@@ -0,0 +1,6 @@
+#include "lib3.h"
+
+float Lib3Func()
+{
+ return 2.0;
+}
diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h
new file mode 100644
index 0000000..e5f4c24
--- /dev/null
+++ b/Tests/SimpleInstall/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();
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
new file mode 100644
index 0000000..e8a9ba8
--- /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 0000000..5c7c3e6
--- /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 0000000..bba9022
--- /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 0000000..47d73c0
--- /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 0000000..7aa9052
--- /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 0000000..0d64e76
--- /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 0000000..dccc48b
--- /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 0000000..aa94eb2
--- /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 0000000..da8dbf9
--- /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 0000000..e5f4c24
--- /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();