ENH: create new test to test subdir exclude

This commit is contained in:
Bill Hoffman 2004-03-09 16:20:41 -05:00
parent c7067f426f
commit bf699505bc
8 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,3 @@
PROJECT(SUBDIR)
SUBDIRS(Executable EXCLUDE_FROM_ALL Examples)
WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")

View File

@ -0,0 +1,2 @@
PROJECT(Examples)
SUBDIRS(example1 example2)

View File

@ -0,0 +1,6 @@
PROJECT(example1)
ADD_EXECUTABLE(example1 example1.cxx)
ADD_CUSTOM_COMMAND(TARGET example1 POST_BUILD
COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere
COMMENT "Remove marker file that should exist because this should not be run")

View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main()
{
printf("example1\n");
return 0;
}

View File

@ -0,0 +1,2 @@
PROJECT(example2)
ADD_EXECUTABLE(example2 example2.cxx)

View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main()
{
printf("example2\n");
return 0;
}

View File

@ -0,0 +1 @@
ADD_EXECUTABLE(test test.cxx)

View File

@ -0,0 +1,36 @@
#include <stdio.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
// return true if the file exists
int FileExists(const char* filename)
{
#ifdef _MSC_VER
# define access _access
#endif
#ifndef F_OK
#define F_OK 0
#endif
if ( access(filename, F_OK) != 0 )
{
return false;
}
else
{
return true;
}
}
int main(int ac, char** av)
{
if(!FileExists(av[1]))
{
printf("Missing file %s\n", av[1]);
return 1;
}
printf("%s is there!", av[1]);
return 0;
}