summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-08-23 17:57:45 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-08-23 17:57:45 (GMT)
commit3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c (patch)
tree7bb6b35243fdc96afa879e06c1f4557ee22318b9 /Tests
parentbd4c5cf3625bc4d23f2f5c20fee7fa0bb34aed4b (diff)
downloadCMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.zip
CMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.tar.gz
CMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.tar.bz2
ENH: try to get better test coverage
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Complex/CMakeLists.txt26
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt4
-rw-r--r--Tests/Complex/Executable/complex.cxx104
-rw-r--r--Tests/Complex/Library/CMakeLists.txt8
-rw-r--r--Tests/Complex/Library/ExtraSources/file1.cxx4
-rw-r--r--Tests/Complex/Library/ExtraSources/file1.h1
-rw-r--r--Tests/Complex/Library/file2.cxx4
-rw-r--r--Tests/Complex/Library/file2.h1
-rw-r--r--Tests/Complex/Library/sharedFile.cxx6
-rw-r--r--Tests/Complex/Library/sharedFile.h12
-rw-r--r--Tests/Complex/VarTests.txt11
-rw-r--r--Tests/Complex/cmTestConfigure.h.in5
-rw-r--r--Tests/Complex/simple.cxx4
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt26
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt4
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx104
-rw-r--r--Tests/ComplexOneConfig/Library/CMakeLists.txt8
-rw-r--r--Tests/ComplexOneConfig/Library/ExtraSources/file1.cxx4
-rw-r--r--Tests/ComplexOneConfig/Library/ExtraSources/file1.h1
-rw-r--r--Tests/ComplexOneConfig/Library/file2.cxx4
-rw-r--r--Tests/ComplexOneConfig/Library/file2.h1
-rw-r--r--Tests/ComplexOneConfig/Library/sharedFile.cxx6
-rw-r--r--Tests/ComplexOneConfig/Library/sharedFile.h12
-rw-r--r--Tests/ComplexOneConfig/VarTests.txt11
-rw-r--r--Tests/ComplexOneConfig/cmTestConfigure.h.in5
-rw-r--r--Tests/ComplexOneConfig/simple.cxx4
-rw-r--r--Tests/ComplexRelativePaths/CMakeLists.txt26
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt4
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx104
-rw-r--r--Tests/ComplexRelativePaths/Library/CMakeLists.txt8
-rw-r--r--Tests/ComplexRelativePaths/Library/ExtraSources/file1.cxx4
-rw-r--r--Tests/ComplexRelativePaths/Library/ExtraSources/file1.h1
-rw-r--r--Tests/ComplexRelativePaths/Library/file2.cxx4
-rw-r--r--Tests/ComplexRelativePaths/Library/file2.h1
-rw-r--r--Tests/ComplexRelativePaths/Library/sharedFile.cxx6
-rw-r--r--Tests/ComplexRelativePaths/Library/sharedFile.h12
-rw-r--r--Tests/ComplexRelativePaths/VarTests.txt11
-rw-r--r--Tests/ComplexRelativePaths/cmTestConfigure.h.in5
-rw-r--r--Tests/ComplexRelativePaths/simple.cxx4
39 files changed, 570 insertions, 0 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
new file mode 100644
index 0000000..c11a47b
--- /dev/null
+++ b/Tests/Complex/CMakeLists.txt
@@ -0,0 +1,26 @@
+# a simple test case
+PROJECT (Complex)
+
+ADD_DEFINITIONS(-DCMAKE_IS_FUN)
+SUBDIRS(Library Executable)
+SUBDIR_DEPENDS(Executable Library)
+
+INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
+
+CONFIGURE_FILE(
+${Complex_SOURCE_DIR}/cmTestConfigure.h.in
+${Complex_BINARY_DIR}/cmTestConfigure.h)
+
+INCLUDE_DIRECTORIES(
+${Complex_BINARY_DIR}
+${Complex_SOURCE_DIR}/Library
+${Complex_SOURCE_DIR}/../../Source
+)
+LINK_DIRECTORIES(
+${Complex_BINARY_DIR}/Library
+)
+
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
+
+SET (LIBRARY_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all libraries.")
+SET (EXECUTABLE_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all executables.")
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
new file mode 100644
index 0000000..f0df86f
--- /dev/null
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -0,0 +1,4 @@
+ADD_EXECUTABLE(complex complex)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibrary)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibraryShared)
+
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
new file mode 100644
index 0000000..9af88ad
--- /dev/null
+++ b/Tests/Complex/Executable/complex.cxx
@@ -0,0 +1,104 @@
+#include "cmTestConfigure.h"
+#include "ExtraSources/file1.h"
+#include "file2.h"
+#include "sharedFile.h"
+#include "cmStandardIncludes.h"
+
+int passed = 0;
+int failed = 0;
+
+void Failed(const char* Message, const char* m2= "")
+{
+ std::cerr << "Failed: " << Message << m2 << "\n";
+ failed++;
+}
+
+void Passed(const char* Message, const char* m2="")
+{
+ std::cout << "Passed: " << Message << m2 << "\n";
+ passed++;
+}
+
+main()
+{
+ if(sharedFunction() != 1)
+ {
+ Failed("Call to sharedFunction from shared library failed.");
+ }
+ else
+ {
+ Passed("Call to sharedFunction from shared library worked.");
+ }
+
+ if(file1() != 1)
+ {
+ Failed("Call to file1 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file1 function returned 1.");
+ }
+ if(file2() != 1)
+ {
+ Failed("Call to file2 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file2 function returned 1.");
+ }
+#ifndef CMAKE_IS_FUN
+ Failed("CMake is not fun, so it is broken and should be fixed.");
+#else
+ Passed("CMAKE_IS_FUN is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
+#else
+ Passed("SHOULD_NOT_BE_DEFINED is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n");
+#else
+ Passed("SHOULD_BE_DEFINED is defined.");
+#endif
+
+#ifndef ONE_VAR
+ Failed("cmakedefine is broken, ONE_VAR is not defined.");
+#else
+ Passed("ONE_VAR is defined.");
+#endif
+
+#ifdef ZERO_VAR
+ Failed("cmakedefine is broken, ZERO_VAR is defined.");
+#else
+ Passed("ZERO_VAR is not defined.");
+#endif
+
+
+
+#ifndef STRING_VAR
+ Failed("configureFile is broken, STRING_VAR is not defined.");
+#else
+ if(strcmp(STRING_VAR, "CMake is great") != 0)
+ {
+ Failed("CMake is not great, so the SET command,"
+ "or the configurefile comand is broken. STRING_VAR== ",
+ STRING_VAR);
+ }
+ else
+ {
+ Passed("STRING_VAR == ", STRING_VAR);
+ }
+#endif
+ std::cout << "Passed:" << passed << "\n";
+ if(failed)
+ {
+ std::cout << "Failed: " << failed << "\n";
+ return failed;
+ }
+ return 0;
+}
+
+
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
new file mode 100644
index 0000000..bc890eb
--- /dev/null
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -0,0 +1,8 @@
+AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
+
+SOURCE_FILES(LibrarySources file2)
+ADD_LIBRARY(CMakeTestLibrary LibrarySources)
+SOURCE_FILES(SharedLibrarySources sharedFile)
+ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
+
+
diff --git a/Tests/Complex/Library/ExtraSources/file1.cxx b/Tests/Complex/Library/ExtraSources/file1.cxx
new file mode 100644
index 0000000..e22812e
--- /dev/null
+++ b/Tests/Complex/Library/ExtraSources/file1.cxx
@@ -0,0 +1,4 @@
+int file1()
+{
+ return 1;
+}
diff --git a/Tests/Complex/Library/ExtraSources/file1.h b/Tests/Complex/Library/ExtraSources/file1.h
new file mode 100644
index 0000000..ce0d818
--- /dev/null
+++ b/Tests/Complex/Library/ExtraSources/file1.h
@@ -0,0 +1 @@
+int file1();
diff --git a/Tests/Complex/Library/file2.cxx b/Tests/Complex/Library/file2.cxx
new file mode 100644
index 0000000..1351669
--- /dev/null
+++ b/Tests/Complex/Library/file2.cxx
@@ -0,0 +1,4 @@
+int file2()
+{
+ return 1;
+}
diff --git a/Tests/Complex/Library/file2.h b/Tests/Complex/Library/file2.h
new file mode 100644
index 0000000..dea4b80
--- /dev/null
+++ b/Tests/Complex/Library/file2.h
@@ -0,0 +1 @@
+int file2();
diff --git a/Tests/Complex/Library/sharedFile.cxx b/Tests/Complex/Library/sharedFile.cxx
new file mode 100644
index 0000000..cafac68
--- /dev/null
+++ b/Tests/Complex/Library/sharedFile.cxx
@@ -0,0 +1,6 @@
+#include "sharedFile.h"
+
+int sharedFunction()
+{
+ return 1;
+}
diff --git a/Tests/Complex/Library/sharedFile.h b/Tests/Complex/Library/sharedFile.h
new file mode 100644
index 0000000..4cdb7a1
--- /dev/null
+++ b/Tests/Complex/Library/sharedFile.h
@@ -0,0 +1,12 @@
+#if defined(_WIN32) || defined(WIN32) /* Win32 version */
+#ifdef CMakeTestLibraryShared_EXPORTS
+# define CMakeTest_EXPORT __declspec(dllexport)
+#else
+# define CMakeTest_EXPORT __declspec(dllimport)
+#endif
+#else
+// unix needs nothing
+#define CMakeTest_EXPORT
+#endif
+
+CMakeTest_EXPORT int sharedFunction();
diff --git a/Tests/Complex/VarTests.txt b/Tests/Complex/VarTests.txt
new file mode 100644
index 0000000..0ff9953
--- /dev/null
+++ b/Tests/Complex/VarTests.txt
@@ -0,0 +1,11 @@
+
+SET (ZERO_VAR 0)
+IF(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
+ELSE(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_BE_DEFINED)
+ENDIF(ZERO_VAR)
+
+SET(ONE_VAR 1)
+
+SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in
new file mode 100644
index 0000000..759a637
--- /dev/null
+++ b/Tests/Complex/cmTestConfigure.h.in
@@ -0,0 +1,5 @@
+#cmakedefine ONE_VAR
+#cmakedefine ZERO_VAR
+#define STRING_VAR "${STRING_VAR}"
+
+
diff --git a/Tests/Complex/simple.cxx b/Tests/Complex/simple.cxx
new file mode 100644
index 0000000..1482f27
--- /dev/null
+++ b/Tests/Complex/simple.cxx
@@ -0,0 +1,4 @@
+int main ()
+{
+ return 0;
+}
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
new file mode 100644
index 0000000..c11a47b
--- /dev/null
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -0,0 +1,26 @@
+# a simple test case
+PROJECT (Complex)
+
+ADD_DEFINITIONS(-DCMAKE_IS_FUN)
+SUBDIRS(Library Executable)
+SUBDIR_DEPENDS(Executable Library)
+
+INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
+
+CONFIGURE_FILE(
+${Complex_SOURCE_DIR}/cmTestConfigure.h.in
+${Complex_BINARY_DIR}/cmTestConfigure.h)
+
+INCLUDE_DIRECTORIES(
+${Complex_BINARY_DIR}
+${Complex_SOURCE_DIR}/Library
+${Complex_SOURCE_DIR}/../../Source
+)
+LINK_DIRECTORIES(
+${Complex_BINARY_DIR}/Library
+)
+
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
+
+SET (LIBRARY_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all libraries.")
+SET (EXECUTABLE_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all executables.")
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
new file mode 100644
index 0000000..f0df86f
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -0,0 +1,4 @@
+ADD_EXECUTABLE(complex complex)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibrary)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibraryShared)
+
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
new file mode 100644
index 0000000..9af88ad
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -0,0 +1,104 @@
+#include "cmTestConfigure.h"
+#include "ExtraSources/file1.h"
+#include "file2.h"
+#include "sharedFile.h"
+#include "cmStandardIncludes.h"
+
+int passed = 0;
+int failed = 0;
+
+void Failed(const char* Message, const char* m2= "")
+{
+ std::cerr << "Failed: " << Message << m2 << "\n";
+ failed++;
+}
+
+void Passed(const char* Message, const char* m2="")
+{
+ std::cout << "Passed: " << Message << m2 << "\n";
+ passed++;
+}
+
+main()
+{
+ if(sharedFunction() != 1)
+ {
+ Failed("Call to sharedFunction from shared library failed.");
+ }
+ else
+ {
+ Passed("Call to sharedFunction from shared library worked.");
+ }
+
+ if(file1() != 1)
+ {
+ Failed("Call to file1 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file1 function returned 1.");
+ }
+ if(file2() != 1)
+ {
+ Failed("Call to file2 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file2 function returned 1.");
+ }
+#ifndef CMAKE_IS_FUN
+ Failed("CMake is not fun, so it is broken and should be fixed.");
+#else
+ Passed("CMAKE_IS_FUN is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
+#else
+ Passed("SHOULD_NOT_BE_DEFINED is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n");
+#else
+ Passed("SHOULD_BE_DEFINED is defined.");
+#endif
+
+#ifndef ONE_VAR
+ Failed("cmakedefine is broken, ONE_VAR is not defined.");
+#else
+ Passed("ONE_VAR is defined.");
+#endif
+
+#ifdef ZERO_VAR
+ Failed("cmakedefine is broken, ZERO_VAR is defined.");
+#else
+ Passed("ZERO_VAR is not defined.");
+#endif
+
+
+
+#ifndef STRING_VAR
+ Failed("configureFile is broken, STRING_VAR is not defined.");
+#else
+ if(strcmp(STRING_VAR, "CMake is great") != 0)
+ {
+ Failed("CMake is not great, so the SET command,"
+ "or the configurefile comand is broken. STRING_VAR== ",
+ STRING_VAR);
+ }
+ else
+ {
+ Passed("STRING_VAR == ", STRING_VAR);
+ }
+#endif
+ std::cout << "Passed:" << passed << "\n";
+ if(failed)
+ {
+ std::cout << "Failed: " << failed << "\n";
+ return failed;
+ }
+ return 0;
+}
+
+
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
new file mode 100644
index 0000000..bc890eb
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -0,0 +1,8 @@
+AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
+
+SOURCE_FILES(LibrarySources file2)
+ADD_LIBRARY(CMakeTestLibrary LibrarySources)
+SOURCE_FILES(SharedLibrarySources sharedFile)
+ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
+
+
diff --git a/Tests/ComplexOneConfig/Library/ExtraSources/file1.cxx b/Tests/ComplexOneConfig/Library/ExtraSources/file1.cxx
new file mode 100644
index 0000000..e22812e
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/ExtraSources/file1.cxx
@@ -0,0 +1,4 @@
+int file1()
+{
+ return 1;
+}
diff --git a/Tests/ComplexOneConfig/Library/ExtraSources/file1.h b/Tests/ComplexOneConfig/Library/ExtraSources/file1.h
new file mode 100644
index 0000000..ce0d818
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/ExtraSources/file1.h
@@ -0,0 +1 @@
+int file1();
diff --git a/Tests/ComplexOneConfig/Library/file2.cxx b/Tests/ComplexOneConfig/Library/file2.cxx
new file mode 100644
index 0000000..1351669
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/file2.cxx
@@ -0,0 +1,4 @@
+int file2()
+{
+ return 1;
+}
diff --git a/Tests/ComplexOneConfig/Library/file2.h b/Tests/ComplexOneConfig/Library/file2.h
new file mode 100644
index 0000000..dea4b80
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/file2.h
@@ -0,0 +1 @@
+int file2();
diff --git a/Tests/ComplexOneConfig/Library/sharedFile.cxx b/Tests/ComplexOneConfig/Library/sharedFile.cxx
new file mode 100644
index 0000000..cafac68
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/sharedFile.cxx
@@ -0,0 +1,6 @@
+#include "sharedFile.h"
+
+int sharedFunction()
+{
+ return 1;
+}
diff --git a/Tests/ComplexOneConfig/Library/sharedFile.h b/Tests/ComplexOneConfig/Library/sharedFile.h
new file mode 100644
index 0000000..4cdb7a1
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/sharedFile.h
@@ -0,0 +1,12 @@
+#if defined(_WIN32) || defined(WIN32) /* Win32 version */
+#ifdef CMakeTestLibraryShared_EXPORTS
+# define CMakeTest_EXPORT __declspec(dllexport)
+#else
+# define CMakeTest_EXPORT __declspec(dllimport)
+#endif
+#else
+// unix needs nothing
+#define CMakeTest_EXPORT
+#endif
+
+CMakeTest_EXPORT int sharedFunction();
diff --git a/Tests/ComplexOneConfig/VarTests.txt b/Tests/ComplexOneConfig/VarTests.txt
new file mode 100644
index 0000000..0ff9953
--- /dev/null
+++ b/Tests/ComplexOneConfig/VarTests.txt
@@ -0,0 +1,11 @@
+
+SET (ZERO_VAR 0)
+IF(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
+ELSE(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_BE_DEFINED)
+ENDIF(ZERO_VAR)
+
+SET(ONE_VAR 1)
+
+SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in
new file mode 100644
index 0000000..759a637
--- /dev/null
+++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in
@@ -0,0 +1,5 @@
+#cmakedefine ONE_VAR
+#cmakedefine ZERO_VAR
+#define STRING_VAR "${STRING_VAR}"
+
+
diff --git a/Tests/ComplexOneConfig/simple.cxx b/Tests/ComplexOneConfig/simple.cxx
new file mode 100644
index 0000000..1482f27
--- /dev/null
+++ b/Tests/ComplexOneConfig/simple.cxx
@@ -0,0 +1,4 @@
+int main ()
+{
+ return 0;
+}
diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt
new file mode 100644
index 0000000..c11a47b
--- /dev/null
+++ b/Tests/ComplexRelativePaths/CMakeLists.txt
@@ -0,0 +1,26 @@
+# a simple test case
+PROJECT (Complex)
+
+ADD_DEFINITIONS(-DCMAKE_IS_FUN)
+SUBDIRS(Library Executable)
+SUBDIR_DEPENDS(Executable Library)
+
+INCLUDE(${Complex_SOURCE_DIR}/VarTests.txt)
+
+CONFIGURE_FILE(
+${Complex_SOURCE_DIR}/cmTestConfigure.h.in
+${Complex_BINARY_DIR}/cmTestConfigure.h)
+
+INCLUDE_DIRECTORIES(
+${Complex_BINARY_DIR}
+${Complex_SOURCE_DIR}/Library
+${Complex_SOURCE_DIR}/../../Source
+)
+LINK_DIRECTORIES(
+${Complex_BINARY_DIR}/Library
+)
+
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
+
+SET (LIBRARY_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all libraries.")
+SET (EXECUTABLE_OUTPUT_PATH ${Complex_BINARY_DIR}/bin/ CACHE PATH "Single output directory for building all executables.")
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
new file mode 100644
index 0000000..f0df86f
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
@@ -0,0 +1,4 @@
+ADD_EXECUTABLE(complex complex)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibrary)
+TARGET_LINK_LIBRARIES(complex CMakeTestLibraryShared)
+
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
new file mode 100644
index 0000000..9af88ad
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -0,0 +1,104 @@
+#include "cmTestConfigure.h"
+#include "ExtraSources/file1.h"
+#include "file2.h"
+#include "sharedFile.h"
+#include "cmStandardIncludes.h"
+
+int passed = 0;
+int failed = 0;
+
+void Failed(const char* Message, const char* m2= "")
+{
+ std::cerr << "Failed: " << Message << m2 << "\n";
+ failed++;
+}
+
+void Passed(const char* Message, const char* m2="")
+{
+ std::cout << "Passed: " << Message << m2 << "\n";
+ passed++;
+}
+
+main()
+{
+ if(sharedFunction() != 1)
+ {
+ Failed("Call to sharedFunction from shared library failed.");
+ }
+ else
+ {
+ Passed("Call to sharedFunction from shared library worked.");
+ }
+
+ if(file1() != 1)
+ {
+ Failed("Call to file1 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file1 function returned 1.");
+ }
+ if(file2() != 1)
+ {
+ Failed("Call to file2 function from library failed.");
+ }
+ else
+ {
+ Passed("Call to file2 function returned 1.");
+ }
+#ifndef CMAKE_IS_FUN
+ Failed("CMake is not fun, so it is broken and should be fixed.");
+#else
+ Passed("CMAKE_IS_FUN is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined.");
+#else
+ Passed("SHOULD_NOT_BE_DEFINED is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED
+ Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n");
+#else
+ Passed("SHOULD_BE_DEFINED is defined.");
+#endif
+
+#ifndef ONE_VAR
+ Failed("cmakedefine is broken, ONE_VAR is not defined.");
+#else
+ Passed("ONE_VAR is defined.");
+#endif
+
+#ifdef ZERO_VAR
+ Failed("cmakedefine is broken, ZERO_VAR is defined.");
+#else
+ Passed("ZERO_VAR is not defined.");
+#endif
+
+
+
+#ifndef STRING_VAR
+ Failed("configureFile is broken, STRING_VAR is not defined.");
+#else
+ if(strcmp(STRING_VAR, "CMake is great") != 0)
+ {
+ Failed("CMake is not great, so the SET command,"
+ "or the configurefile comand is broken. STRING_VAR== ",
+ STRING_VAR);
+ }
+ else
+ {
+ Passed("STRING_VAR == ", STRING_VAR);
+ }
+#endif
+ std::cout << "Passed:" << passed << "\n";
+ if(failed)
+ {
+ std::cout << "Failed: " << failed << "\n";
+ return failed;
+ }
+ return 0;
+}
+
+
diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt
new file mode 100644
index 0000000..bc890eb
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt
@@ -0,0 +1,8 @@
+AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources)
+
+SOURCE_FILES(LibrarySources file2)
+ADD_LIBRARY(CMakeTestLibrary LibrarySources)
+SOURCE_FILES(SharedLibrarySources sharedFile)
+ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
+
+
diff --git a/Tests/ComplexRelativePaths/Library/ExtraSources/file1.cxx b/Tests/ComplexRelativePaths/Library/ExtraSources/file1.cxx
new file mode 100644
index 0000000..e22812e
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/ExtraSources/file1.cxx
@@ -0,0 +1,4 @@
+int file1()
+{
+ return 1;
+}
diff --git a/Tests/ComplexRelativePaths/Library/ExtraSources/file1.h b/Tests/ComplexRelativePaths/Library/ExtraSources/file1.h
new file mode 100644
index 0000000..ce0d818
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/ExtraSources/file1.h
@@ -0,0 +1 @@
+int file1();
diff --git a/Tests/ComplexRelativePaths/Library/file2.cxx b/Tests/ComplexRelativePaths/Library/file2.cxx
new file mode 100644
index 0000000..1351669
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/file2.cxx
@@ -0,0 +1,4 @@
+int file2()
+{
+ return 1;
+}
diff --git a/Tests/ComplexRelativePaths/Library/file2.h b/Tests/ComplexRelativePaths/Library/file2.h
new file mode 100644
index 0000000..dea4b80
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/file2.h
@@ -0,0 +1 @@
+int file2();
diff --git a/Tests/ComplexRelativePaths/Library/sharedFile.cxx b/Tests/ComplexRelativePaths/Library/sharedFile.cxx
new file mode 100644
index 0000000..cafac68
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/sharedFile.cxx
@@ -0,0 +1,6 @@
+#include "sharedFile.h"
+
+int sharedFunction()
+{
+ return 1;
+}
diff --git a/Tests/ComplexRelativePaths/Library/sharedFile.h b/Tests/ComplexRelativePaths/Library/sharedFile.h
new file mode 100644
index 0000000..4cdb7a1
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/sharedFile.h
@@ -0,0 +1,12 @@
+#if defined(_WIN32) || defined(WIN32) /* Win32 version */
+#ifdef CMakeTestLibraryShared_EXPORTS
+# define CMakeTest_EXPORT __declspec(dllexport)
+#else
+# define CMakeTest_EXPORT __declspec(dllimport)
+#endif
+#else
+// unix needs nothing
+#define CMakeTest_EXPORT
+#endif
+
+CMakeTest_EXPORT int sharedFunction();
diff --git a/Tests/ComplexRelativePaths/VarTests.txt b/Tests/ComplexRelativePaths/VarTests.txt
new file mode 100644
index 0000000..0ff9953
--- /dev/null
+++ b/Tests/ComplexRelativePaths/VarTests.txt
@@ -0,0 +1,11 @@
+
+SET (ZERO_VAR 0)
+IF(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED)
+ELSE(ZERO_VAR)
+ADD_DEFINITIONS(-DSHOULD_BE_DEFINED)
+ENDIF(ZERO_VAR)
+
+SET(ONE_VAR 1)
+
+SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable")
diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
new file mode 100644
index 0000000..759a637
--- /dev/null
+++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
@@ -0,0 +1,5 @@
+#cmakedefine ONE_VAR
+#cmakedefine ZERO_VAR
+#define STRING_VAR "${STRING_VAR}"
+
+
diff --git a/Tests/ComplexRelativePaths/simple.cxx b/Tests/ComplexRelativePaths/simple.cxx
new file mode 100644
index 0000000..1482f27
--- /dev/null
+++ b/Tests/ComplexRelativePaths/simple.cxx
@@ -0,0 +1,4 @@
+int main ()
+{
+ return 0;
+}