summaryrefslogtreecommitdiffstats
path: root/Tests/Complex
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-01-17 15:21:45 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-01-17 15:21:45 (GMT)
commit9891260a6dab66c9ea44b5c2e244f3128625baf5 (patch)
tree930651e4383fe1d904cc9c493bd859cb97b530af /Tests/Complex
parent2694ad76c538333d3ff45613bd1201f97af003cd (diff)
downloadCMake-9891260a6dab66c9ea44b5c2e244f3128625baf5.zip
CMake-9891260a6dab66c9ea44b5c2e244f3128625baf5.tar.gz
CMake-9891260a6dab66c9ea44b5c2e244f3128625baf5.tar.bz2
ENH: add support for watcom wmake and wcl386
Diffstat (limited to 'Tests/Complex')
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt5
-rw-r--r--Tests/Complex/Executable/complex.cxx121
-rw-r--r--Tests/Complex/cmTestConfigure.h.in1
3 files changed, 74 insertions, 53 deletions
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index e3e11ea..78ed587 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -19,7 +19,10 @@ LINK_LIBRARIES(${COMPLEX_LIBS})
ADD_EXECUTABLE(A A.cxx)
ADD_EXECUTABLE(complex complex testcflags.c)
ADD_EXECUTABLE(complex.file complex.file.cxx)
-TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar)
+IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
+ TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar)
+ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
+
IF (UNIX)
TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS})
ELSE(UNIX)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 9fac9ab..06af8ec 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -8,19 +8,44 @@
extern "C" {
#include "testConly.h"
}
+#ifndef CMAKE_TEST_DIFFERENT_GENERATOR
#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
#include "cmDynamicLoader.h"
#include "cmSystemTools.h"
#include "cmOrderLinkDirectories.h"
#include "cmGeneratedFileStream.h"
+#else
+#include <vector>
+#include <string>
+#include <iostream>
+#include <string.h>
+#endif
+
int cm_passed = 0;
int cm_failed = 0;
+// ======================================================================
+
+void cmFailed(const char* Message, const char* m2= "", const char* m3 = "")
+{
+ std::cout << "FAILED: " << Message << m2 << m3 << "\n";
+ cm_failed++;
+}
+
+// ======================================================================
+
+void cmPassed(const char* Message, const char* m2="")
+{
+ std::cout << "Passed: " << Message << m2 << "\n";
+ cm_passed++;
+}
#ifndef CMAKE_IS_REALLY_FUN
This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
+
+#ifndef CMAKE_TEST_DIFFERENT_GENERATOR
// Here is a stupid function that tries to use std::string methods
// so that the dec cxx compiler will instantiate the stuff that
// we are using from the CMakeLib library....
@@ -99,43 +124,6 @@ bool TestLibraryOrder(bool shouldFail)
return ret;
}
-void ForceStringUse()
-{
- std::vector<std::string> v;
- std::vector<std::string> v2;
- v = v2;
- std::string cachetest = CACHE_TEST_VAR_INTERNAL;
- v.push_back(cachetest);
- v2 = v;
- std::string x(5,'x');
- char buff[5];
- x.copy(buff, 1, 0);
- x[0] = 'a';
- std::string::size_type pos = 0;
- x.replace(pos, pos, pos, 'x');
- std::string copy = cachetest;
- cachetest.find("bar");
- cachetest.rfind("bar");
- copy.append(cachetest);
- copy = cachetest.substr(0, cachetest.size());
-}
-
-// ======================================================================
-
-void cmFailed(const char* Message, const char* m2= "", const char* m3 = "")
-{
- std::cout << "FAILED: " << Message << m2 << m3 << "\n";
- cm_failed++;
-}
-
-// ======================================================================
-
-void cmPassed(const char* Message, const char* m2="")
-{
- std::cout << "Passed: " << Message << m2 << "\n";
- cm_passed++;
-}
-
// ======================================================================
void TestAndRemoveFile(const char* filename)
@@ -258,6 +246,30 @@ void TestCMGeneratedFileSTream()
cmSystemTools::RemoveFile(file2tmp.c_str());
cmSystemTools::RemoveFile(file3tmp.c_str());
}
+#endif
+
+void ForceStringUse()
+{
+ std::vector<std::string> v;
+ std::vector<std::string> v2;
+ v = v2;
+ std::string cachetest = CACHE_TEST_VAR_INTERNAL;
+ v.push_back(cachetest);
+ v2 = v;
+ std::string x(5,'x');
+ char buff[5];
+ x.copy(buff, 1, 0);
+ x[0] = 'a';
+ std::string::size_type pos = 0;
+ x.replace(pos, pos, pos, 'x');
+ std::string copy = cachetest;
+ cachetest.find("bar");
+ cachetest.rfind("bar");
+ copy.append(cachetest);
+ copy = cachetest.substr(0, cachetest.size());
+}
+
+
// defined in testcflags.c
extern "C" int TestCFlags(char* m);
@@ -273,6 +285,7 @@ int main()
#endif
std::string exe = lib;
+#ifndef CMAKE_TEST_DIFFERENT_GENERATOR
// Test a single character executable to test a: in makefiles
exe += "A";
exe += cmSystemTools::GetExecutableExtension();
@@ -352,6 +365,20 @@ int main()
cmPassed("Call to C sharedFunction from shared library worked.");
}
+ // ----------------------------------------------------------------------
+ // Test cmSystemTools::UpperCase
+ std::string str = "abc";
+ std::string strupper = "ABC";
+ if(cmSystemTools::UpperCase(str) == strupper)
+ {
+ cmPassed("cmSystemTools::UpperCase is working");
+ }
+ else
+ {
+ cmFailed("cmSystemTools::UpperCase is working");
+ }
+#endif
+
if(file1() != 1)
{
cmFailed("Call to file1 function from library failed.");
@@ -926,6 +953,7 @@ int main()
}
#endif
+#ifndef CMAKE_TEST_DIFFERENT_GENERATOR
// ----------------------------------------------------------------------
// Some pre-build/pre-link/post-build custom-commands have been
// attached to the lib (see Library/).
@@ -955,7 +983,7 @@ int main()
// only created during a build.
TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt");
-
+
// ----------------------------------------------------------------------
// A directory has been created.
@@ -971,6 +999,7 @@ int main()
// only created during a build.
TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
+#endif
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
@@ -1088,19 +1117,6 @@ int main()
// ----------------------------------------------------------------------
- // Test cmSystemTools::UpperCase
- std::string str = "abc";
- std::string strupper = "ABC";
- if(cmSystemTools::UpperCase(str) == strupper)
- {
- cmPassed("cmSystemTools::UpperCase is working");
- }
- else
- {
- cmFailed("cmSystemTools::UpperCase is working");
- }
-
- // ----------------------------------------------------------------------
// Test if IF command inside a FOREACH works.
#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED)
cmPassed("IF inside a FOREACH block works");
@@ -1135,6 +1151,7 @@ int main()
cmPassed("CMake SET CACHE FORCE");
#endif
+#ifndef CMAKE_TEST_DIFFERENT_GENERATOR
// first run with shouldFail = true, this will
// run with A B C as set by the CMakeList.txt file.
if(!TestLibraryOrder(true))
@@ -1156,9 +1173,9 @@ int main()
{
cmFailed("CMake cmOrderLinkDirectories failed.");
}
-
// Test the generated file stream.
TestCMGeneratedFileSTream();
+#endif
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in
index eadd2f0..f2017ab 100644
--- a/Tests/Complex/cmTestConfigure.h.in
+++ b/Tests/Complex/cmTestConfigure.h.in
@@ -4,6 +4,7 @@
#cmakedefine ONE_VAR_IS_DEFINED
#cmakedefine ZERO_VAR
+#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR
#define STRING_VAR "${STRING_VAR}"
// Test FOREACH