ENH: new test for spaces in the tree structure
This commit is contained in:
parent
74968ce1c7
commit
83b5890a2f
6
Tests/SubDirSpaces/Another Subdir/pair+int.int.c
Normal file
6
Tests/SubDirSpaces/Another Subdir/pair+int.int.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void pair_stuff()
|
||||
{
|
||||
printf("Placeholder for a strange file in subdirectory\n");
|
||||
}
|
6
Tests/SubDirSpaces/Another Subdir/pair_int.int.c
Normal file
6
Tests/SubDirSpaces/Another Subdir/pair_int.int.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void pair_stuff()
|
||||
{
|
||||
printf("Placeholder for a strange file in subdirectory\n");
|
||||
}
|
6
Tests/SubDirSpaces/Another Subdir/secondone.c
Normal file
6
Tests/SubDirSpaces/Another Subdir/secondone.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void secondone()
|
||||
{
|
||||
printf("Hello again\n");
|
||||
}
|
14
Tests/SubDirSpaces/Another Subdir/testfromsubdir.c
Normal file
14
Tests/SubDirSpaces/Another Subdir/testfromsubdir.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void secondone();
|
||||
void pair_stuff();
|
||||
void vcl_stuff();
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello from subdirectory\n");
|
||||
secondone();
|
||||
pair_stuff();
|
||||
vcl_stuff();
|
||||
return 0;
|
||||
}
|
43
Tests/SubDirSpaces/CMakeLists.txt
Normal file
43
Tests/SubDirSpaces/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
||||
PROJECT(SUBDIR)
|
||||
SUBDIRS(Executable EXCLUDE_FROM_ALL "Some Examples")
|
||||
WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
|
||||
#WATCOM WMAKE does not support + in the name of a file!
|
||||
IF(WATCOM)
|
||||
SET(PLUS_NAME_FILES
|
||||
"Another Subdir/pair_int.int.c"
|
||||
vcl_algorithm_vcl_pair_double.foo.c)
|
||||
ELSE(WATCOM)
|
||||
SET(PLUS_NAME_FILES
|
||||
"Another Subdir/pair+int.int.c"
|
||||
vcl_algorithm+vcl_pair+double.foo.c)
|
||||
ENDIF(WATCOM)
|
||||
|
||||
ADD_EXECUTABLE(TestFromSubdir
|
||||
"Another Subdir/testfromsubdir.c"
|
||||
"Another Subdir/secondone"
|
||||
${PLUS_NAME_FILES}
|
||||
)
|
||||
|
||||
AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES)
|
||||
IF(WATCOM)
|
||||
FOREACH(f ${SOURCES})
|
||||
IF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
|
||||
ELSE("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
|
||||
SET(SOURCES2 ${f} ${SOURCES2})
|
||||
ENDIF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c")
|
||||
ENDFOREACH(f)
|
||||
SET(SOURCES ${SOURCES2})
|
||||
SET(SOURCES ${SOURCES}
|
||||
vcl_algorithm_vcl_pair_double.foo.c)
|
||||
ELSE(WATCOM)
|
||||
FOREACH(f ${SOURCES})
|
||||
IF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
|
||||
ELSE("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
|
||||
SET(SOURCES2 ${f} ${SOURCES2})
|
||||
ENDIF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c")
|
||||
ENDFOREACH(f)
|
||||
SET(SOURCES ${SOURCES2})
|
||||
SET(SOURCES ${SOURCES}
|
||||
vcl_algorithm+vcl_pair+double.foo.c)
|
||||
ENDIF(WATCOM)
|
||||
ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES})
|
1
Tests/SubDirSpaces/Executable/CMakeLists.txt
Normal file
1
Tests/SubDirSpaces/Executable/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
ADD_EXECUTABLE(test test.cxx)
|
49
Tests/SubDirSpaces/Executable/test.cxx
Normal file
49
Tests/SubDirSpaces/Executable/test.cxx
Normal file
@ -0,0 +1,49 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// 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(ac <= 1)
|
||||
{
|
||||
printf("Usage: %s <file>\n", av[0]);
|
||||
return 1;
|
||||
}
|
||||
if(!FileExists(av[1]))
|
||||
{
|
||||
printf("Missing file %s\n", av[1]);
|
||||
return 1;
|
||||
}
|
||||
if(FileExists(av[2]))
|
||||
{
|
||||
printf("File %s should be in subdirectory\n", av[2]);
|
||||
return 1;
|
||||
}
|
||||
printf("%s is not there! Good.", av[2]);
|
||||
printf("%s is there! Good.", av[1]);
|
||||
return 0;
|
||||
}
|
2
Tests/SubDirSpaces/Some Examples/CMakeLists.txt
Normal file
2
Tests/SubDirSpaces/Some Examples/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
PROJECT(Examples)
|
||||
SUBDIRS(example1 example2)
|
6
Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt
Normal file
6
Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt
Normal 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")
|
7
Tests/SubDirSpaces/Some Examples/example1/example1.cxx
Normal file
7
Tests/SubDirSpaces/Some Examples/example1/example1.cxx
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("example1\n");
|
||||
return 0;
|
||||
}
|
2
Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt
Normal file
2
Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
PROJECT(example2)
|
||||
ADD_EXECUTABLE(example2 example2.cxx)
|
7
Tests/SubDirSpaces/Some Examples/example2/example2.cxx
Normal file
7
Tests/SubDirSpaces/Some Examples/example2/example2.cxx
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("example2\n");
|
||||
return 0;
|
||||
}
|
6
Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c
Normal file
6
Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void pair_stuff()
|
||||
{
|
||||
printf("Placeholder for a strange file in subdirectory\n");
|
||||
}
|
6
Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c
Normal file
6
Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void pair_stuff()
|
||||
{
|
||||
printf("Placeholder for a strange file in subdirectory\n");
|
||||
}
|
6
Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c
Normal file
6
Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void pair_p_stuff()
|
||||
{
|
||||
printf("Placeholder for another strange file in subdirectory\n");
|
||||
}
|
16
Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c
Normal file
16
Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void secondone();
|
||||
void pair_stuff();
|
||||
void pair_p_stuff();
|
||||
void vcl_stuff();
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello from subdirectory\n");
|
||||
secondone();
|
||||
pair_stuff();
|
||||
pair_p_stuff();
|
||||
vcl_stuff();
|
||||
return 0;
|
||||
}
|
6
Tests/SubDirSpaces/ThirdSubDir/thirdone.c
Normal file
6
Tests/SubDirSpaces/ThirdSubDir/thirdone.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void secondone()
|
||||
{
|
||||
printf("Hello again\n");
|
||||
}
|
6
Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c
Normal file
6
Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void vcl_stuff()
|
||||
{
|
||||
printf("Placeholder for a file with strange name\n");
|
||||
}
|
6
Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c
Normal file
6
Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void vcl_stuff()
|
||||
{
|
||||
printf("Placeholder for a file with strange name\n");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user