diff options
Diffstat (limited to 'Tests/LoadCommand')
-rw-r--r-- | Tests/LoadCommand/CMakeCommands/cmTestCommand.c | 34 | ||||
-rw-r--r-- | Tests/LoadCommand/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/LoadCommand/LoadedCommand.cxx.in | 41 |
3 files changed, 77 insertions, 4 deletions
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c index bd36b5c21f..b1431cfc57 100644 --- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c @@ -20,6 +20,9 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) char buffer[1024]; void *source_file; char *args[2]; + char *ccArgs[4]; + char *ccDep[1]; + char *ccOut[1]; cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; cmVTKWrapTclData *cdata = @@ -72,8 +75,6 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DisplaySatus(mf, str); info->CAPI->Free(str); - info->CAPI->Free(file); - info->CAPI->DisplaySatus(mf, info->CAPI->GetProjectName(mf)); info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeDirectory(mf)); info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeOutputDirectory(mf)); @@ -117,9 +118,36 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) info->CAPI->DestroySourceFile(source_file); - srcs = "LoadedCommand.cxx"; + srcs = argv[2]; info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0); + /* add customs commands to generate the source file */ + ccArgs[0] = "-E"; + ccArgs[1] = "copy"; + ccArgs[2] = argv[0]; + ccArgs[3] = argv[1]; + ccDep[0] = ccArgs[2]; + ccOut[0] = ccArgs[3]; + info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", + file, + 4, ccArgs, + 1, ccDep, + 1, ccOut, + "LoadedCommand"); + + + ccArgs[2] = argv[1]; + ccArgs[3] = argv[2]; + ccDep[0] = ccArgs[2]; + ccOut[0] = ccArgs[3]; + info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], + file, + 4, ccArgs, + ccDep[0], + 0, 0); + + info->CAPI->Free(file); + args[0] = "TEST_EXEC"; args[1] = "TRUE"; diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index 411d439f37..30463ef8a0 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -51,7 +51,11 @@ IF (COMPILE_OK) ) # if the command loaded, execute the command IF (COMMAND CMAKE_TEST_COMMAND) - CMAKE_TEST_COMMAND() + CMAKE_TEST_COMMAND( + "${LoadedCommand_SOURCE_DIR}/LoadedCommand.cxx.in" + "${LoadedCommand_BINARY_DIR}/LoadedCommand2.cxx.in" + "${LoadedCommand_BINARY_DIR}/LoadedCommand3.cxx" + ) ENDIF (COMMAND CMAKE_TEST_COMMAND) ELSE (COMPILE_OK) MESSAGE("failed to compile CMAKE_LOADED_COMMANDS") diff --git a/Tests/LoadCommand/LoadedCommand.cxx.in b/Tests/LoadCommand/LoadedCommand.cxx.in new file mode 100644 index 0000000000..c58bcf1531 --- /dev/null +++ b/Tests/LoadCommand/LoadedCommand.cxx.in @@ -0,0 +1,41 @@ +#include "LoadedCommand.h" +#include <stdio.h> + +int testSizeOf(int s1, int s2) +{ + return s1 - s2; +} + +int main () +{ + int ret = 0; +#ifdef HAVE_VSBLABLA + printf("Should not be able to find vsblabla\n"); + ret = 1; +#endif + +#if !defined( HAVE_PRINTF ) + printf("Should be able to find printf\n"); + ret= 1; +#endif + +#if !defined( ADDED_DEFINITION ) + printf("Should have ADDED_DEFINITION defined\n"); + ret= 1; +#endif +#if !defined(CMAKE_IS_FUN) + printf("Loaded Command was not built with CMAKE_IS_FUN: failed.\n"); + ret = 1; +#endif + if(testSizeOf(SIZEOF_CHAR, sizeof(char))) + { + printf("Size of char is broken.\n"); + ret = 1; + } + if(testSizeOf(SIZEOF_SHORT, sizeof(short))) + { + printf("Size of short is broken.\n"); + ret = 1; + } + return ret; +} |