diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 15:39:57 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 15:39:57 -0700 |
commit | 035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch) | |
tree | 7e40f5a790eae329a8c5d3e59f046451767956ff /Tests/SubDirSpaces | |
download | cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2 cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip |
Imported Upstream version 2.8.9upstream/2.8.9
Diffstat (limited to 'Tests/SubDirSpaces')
23 files changed, 296 insertions, 0 deletions
diff --git a/Tests/SubDirSpaces/Another Subdir/pair+int.int.c b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDirSpaces/Another Subdir/pair_int.int.c b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDirSpaces/Another Subdir/secondone.c b/Tests/SubDirSpaces/Another Subdir/secondone.c new file mode 100644 index 000000000..3e9e5afe6 --- /dev/null +++ b/Tests/SubDirSpaces/Another Subdir/secondone.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void secondone() +{ + printf("Hello again\n"); +} diff --git a/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c new file mode 100644 index 000000000..34b6e7a88 --- /dev/null +++ b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c @@ -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; +} diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt new file mode 100644 index 000000000..879530b56 --- /dev/null +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required (VERSION 2.6) +PROJECT(SUBDIR) + +# Some systems do not seem to support rpath with spaces. +IF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") + SET(CMAKE_SKIP_BUILD_RPATH 1) +ENDIF("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") + +# be able to see output from make on dashboards +SET(CMAKE_VERBOSE_MAKEFILE 1) +message("${CMAKE_MAKE_PROGRAM}") +set(CMAKE_PAREN TRUE) +IF("${CMAKE_MAKE_PROGRAM}" MATCHES "wmake") + message("wmake does not support () in path") + set(CMAKE_PAREN FALSE) +elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "make") + execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version + RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) + if("${out}" MATCHES "GNU Make 3.82") + # GNU Make 3.82 fails on parens: http://savannah.gnu.org/bugs/?30612 + message(STATUS "GNU Make 3.82 sometimes fails on () in path") + set(CMAKE_PAREN FALSE) + endif() +endif() + +IF(CMAKE_PAREN) + ADD_DEFINITIONS(-DCMAKE_PAREN=1) + SUBDIRS("Executable Sources" "Some(x86) Sources" EXCLUDE_FROM_ALL "Some Examples") +ELSE(CMAKE_PAREN) + SUBDIRS("Executable Sources" EXCLUDE_FROM_ALL "Some Examples") +ENDIF(CMAKE_PAREN) + +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}) +IF(CMAKE_PAREN) + target_link_libraries(TestWithAuxSourceDir testOddPath) +ENDIF(CMAKE_PAREN) + diff --git a/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt b/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt new file mode 100644 index 000000000..d679168d8 --- /dev/null +++ b/Tests/SubDirSpaces/Executable Sources/CMakeLists.txt @@ -0,0 +1 @@ +ADD_EXECUTABLE(test test.cxx) diff --git a/Tests/SubDirSpaces/Executable Sources/test.cxx b/Tests/SubDirSpaces/Executable Sources/test.cxx new file mode 100644 index 000000000..c528fb166 --- /dev/null +++ b/Tests/SubDirSpaces/Executable Sources/test.cxx @@ -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; +} diff --git a/Tests/SubDirSpaces/Executable/CMakeLists.txt b/Tests/SubDirSpaces/Executable/CMakeLists.txt new file mode 100644 index 000000000..d679168d8 --- /dev/null +++ b/Tests/SubDirSpaces/Executable/CMakeLists.txt @@ -0,0 +1 @@ +ADD_EXECUTABLE(test test.cxx) diff --git a/Tests/SubDirSpaces/Executable/test.cxx b/Tests/SubDirSpaces/Executable/test.cxx new file mode 100644 index 000000000..c528fb166 --- /dev/null +++ b/Tests/SubDirSpaces/Executable/test.cxx @@ -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; +} diff --git a/Tests/SubDirSpaces/Some Examples/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/CMakeLists.txt new file mode 100644 index 000000000..b0f1e896c --- /dev/null +++ b/Tests/SubDirSpaces/Some Examples/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required (VERSION 2.6) +PROJECT(Examples) +SUBDIRS(example1 example2) diff --git a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt new file mode 100644 index 000000000..303618321 --- /dev/null +++ b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required (VERSION 2.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") diff --git a/Tests/SubDirSpaces/Some Examples/example1/example1.cxx b/Tests/SubDirSpaces/Some Examples/example1/example1.cxx new file mode 100644 index 000000000..3c4819415 --- /dev/null +++ b/Tests/SubDirSpaces/Some Examples/example1/example1.cxx @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("example1\n"); + return 0; +} diff --git a/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt new file mode 100644 index 000000000..19a537686 --- /dev/null +++ b/Tests/SubDirSpaces/Some Examples/example2/CMakeLists.txt @@ -0,0 +1,2 @@ +PROJECT(example2) +ADD_EXECUTABLE(example2 example2.cxx) diff --git a/Tests/SubDirSpaces/Some Examples/example2/example2.cxx b/Tests/SubDirSpaces/Some Examples/example2/example2.cxx new file mode 100644 index 000000000..60ef3c940 --- /dev/null +++ b/Tests/SubDirSpaces/Some Examples/example2/example2.cxx @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("example2\n"); + return 0; +} diff --git a/Tests/SubDirSpaces/Some(x86) Sources/CMakeLists.txt b/Tests/SubDirSpaces/Some(x86) Sources/CMakeLists.txt new file mode 100644 index 000000000..cfba9169c --- /dev/null +++ b/Tests/SubDirSpaces/Some(x86) Sources/CMakeLists.txt @@ -0,0 +1 @@ +add_library(testOddPath test.c) diff --git a/Tests/SubDirSpaces/Some(x86) Sources/test.c b/Tests/SubDirSpaces/Some(x86) Sources/test.c new file mode 100644 index 000000000..66568d4c2 --- /dev/null +++ b/Tests/SubDirSpaces/Some(x86) Sources/test.c @@ -0,0 +1,3 @@ +void testOdd() +{ +} diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c new file mode 100644 index 000000000..b7a623781 --- /dev/null +++ b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c new file mode 100644 index 000000000..95a66eee6 --- /dev/null +++ b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_p_stuff() +{ + printf("Placeholder for another strange file in subdirectory\n"); +} diff --git a/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c new file mode 100644 index 000000000..fa6c33ced --- /dev/null +++ b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c @@ -0,0 +1,21 @@ +#include <stdio.h> + +void secondone(); +void pair_stuff(); +void pair_p_stuff(); +void vcl_stuff(); +#ifdef CMAKE_PAREN +void testOdd(); +#endif +int main() +{ + printf("Hello from subdirectory\n"); + secondone(); +#ifdef CMAKE_PAREN + testOdd(); +#endif + pair_stuff(); + pair_p_stuff(); + vcl_stuff(); + return 0; +} diff --git a/Tests/SubDirSpaces/ThirdSubDir/thirdone.c b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c new file mode 100644 index 000000000..3e9e5afe6 --- /dev/null +++ b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void secondone() +{ + printf("Hello again\n"); +} diff --git a/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c new file mode 100644 index 000000000..a0c60f75a --- /dev/null +++ b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void vcl_stuff() +{ + printf("Placeholder for a file with strange name\n"); +} diff --git a/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c new file mode 100644 index 000000000..a0c60f75a --- /dev/null +++ b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void vcl_stuff() +{ + printf("Placeholder for a file with strange name\n"); +} |