summaryrefslogtreecommitdiffstats
path: root/Tests/ComplexOneConfig/Executable
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2002-01-17 20:49:08 (GMT)
committerSebastien Barre <sebastien.barre@kitware.com>2002-01-17 20:49:08 (GMT)
commite8c4fbef82bac94ee18cd99518357de1b1f237e8 (patch)
treee088c9f771324bf98a48560bd11ef8cd9f8e7cef /Tests/ComplexOneConfig/Executable
parent201764e166b26acfceef983c026b8aae452ed466 (diff)
downloadCMake-e8c4fbef82bac94ee18cd99518357de1b1f237e8.zip
CMake-e8c4fbef82bac94ee18cd99518357de1b1f237e8.tar.gz
CMake-e8c4fbef82bac94ee18cd99518357de1b1f237e8.tar.bz2
ENH: tests ADD_DEPENDENCIES and ADD_CUSTOM_COMMAND
Diffstat (limited to 'Tests/ComplexOneConfig/Executable')
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx38
1 files changed, 34 insertions, 4 deletions
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 8202cee..4bbb14b 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -3,6 +3,17 @@
#include "file2.h"
#include "sharedFile.h"
#include "cmStandardIncludes.h"
+#include <sys/stat.h>
+#include <stdio.h>
+#include <io.h>
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define _unlink unlink
+#else
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#endif
int passed = 0;
int failed = 0;
@@ -38,6 +49,7 @@ int main()
{
Passed("Call to file1 function returned 1.");
}
+
if(file2() != 1)
{
Failed("Call to file2 function from library failed.");
@@ -46,6 +58,7 @@ int main()
{
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
@@ -76,8 +89,6 @@ int main()
Passed("ZERO_VAR is not defined.");
#endif
-
-
#ifndef STRING_VAR
Failed("configureFile is broken, STRING_VAR is not defined.");
#else
@@ -92,13 +103,32 @@ int main()
Passed("STRING_VAR == ", STRING_VAR);
}
#endif
+
+ // Attach a post-build custom-command to the lib.
+ // It run ${CREATE_FILE_EXE} which will create the file
+ // ${Complex_BINARY_DIR}/postbuild.txt.
+ // The 'complex' executable will then test if this file exists,
+ // and remove it.
+
+ struct stat fs;
+ if (stat(BINARY_DIR "/postbuild.txt", &fs) != 0)
+ {
+ Failed("Could not find " BINARY_DIR "/postbuild.txt (created as a post-build custom command for the shared lib).");
+ }
+ else
+ {
+ if (unlink(BINARY_DIR "/postbuild.txt") != 0)
+ {
+ Failed("Unable to remove " BINARY_DIR "/postbuild.txt (does not imply that this test failed, but it *will* be corrupted thereafter if this file is not removed).");
+ }
+ }
+
std::cout << "Passed:" << passed << "\n";
if(failed)
{
std::cout << "Failed: " << failed << "\n";
return failed;
}
+
return 0;
}
-
-