diff options
Diffstat (limited to 'Tests/SimpleInstall')
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 36 | ||||
-rw-r--r-- | Tests/SimpleInstall/foo.c | 6 | ||||
-rw-r--r-- | Tests/SimpleInstall/foo.h | 11 | ||||
-rw-r--r-- | Tests/SimpleInstall/inst.cxx | 22 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib1.cxx | 6 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib1.h | 1 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib2.cxx | 6 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib2.h | 11 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib3.cxx | 6 | ||||
-rw-r--r-- | Tests/SimpleInstall/lib3.h | 11 |
10 files changed, 116 insertions, 0 deletions
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(); |