diff options
Diffstat (limited to 'Tests/SimpleExclude')
-rw-r--r-- | Tests/SimpleExclude/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/t1.c | 8 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/t2.c | 7 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/t3.c | 7 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/t4.c | 17 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirA/t5.c | 7 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirB/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirB/t6.c | 8 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirC/dirB/t7.c | 16 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirD/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirD/t8.c | 7 | ||||
-rw-r--r-- | Tests/SimpleExclude/dirD/t9.c | 24 | ||||
-rw-r--r-- | Tests/SimpleExclude/run.cmake.in | 13 |
15 files changed, 150 insertions, 0 deletions
diff --git a/Tests/SimpleExclude/CMakeLists.txt b/Tests/SimpleExclude/CMakeLists.txt new file mode 100644 index 000000000..baca23e39 --- /dev/null +++ b/Tests/SimpleExclude/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) +project(SimpleExclude C) + +set(EXECUTABLE_OUTPUT_PATH "${SimpleExclude_BINARY_DIR}" CACHE INTERNAL "" FORCE) +set(LIBRARY_OUTPUT_PATH "${SimpleExclude_BINARY_DIR}" CACHE INTERNAL "" FORCE) + +add_subdirectory(dirC EXCLUDE_FROM_ALL) +add_subdirectory(dirD) + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/run.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/run.cmake" @ONLY) diff --git a/Tests/SimpleExclude/dirC/CMakeLists.txt b/Tests/SimpleExclude/dirC/CMakeLists.txt new file mode 100644 index 000000000..9b59fdaff --- /dev/null +++ b/Tests/SimpleExclude/dirC/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(dirA EXCLUDE_FROM_ALL) +add_subdirectory(dirB) + diff --git a/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt b/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt new file mode 100644 index 000000000..52fac8183 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(t1 STATIC t1.c) + +add_library(t2 STATIC t2.c) + +add_executable(t3 t3.c) + +add_executable(t4 t4.c) + +add_executable(t5 t5.c) +target_link_libraries(t5 t1) diff --git a/Tests/SimpleExclude/dirC/dirA/t1.c b/Tests/SimpleExclude/dirC/dirA/t1.c new file mode 100644 index 000000000..67fe06fee --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/t1.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int tlib1func() +{ + Should not be build unless target directory A, B, or C are build; + printf("This is T1\n"); + return 5; +} diff --git a/Tests/SimpleExclude/dirC/dirA/t2.c b/Tests/SimpleExclude/dirC/dirA/t2.c new file mode 100644 index 000000000..6aaf40675 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/t2.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int tlib2func() +{ + printf("This is T2\n"); + return 2; +} diff --git a/Tests/SimpleExclude/dirC/dirA/t3.c b/Tests/SimpleExclude/dirC/dirA/t3.c new file mode 100644 index 000000000..1366dc0a6 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/t3.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char* argv[]) +{ + Should not be build unless target directory A, B, or C are build; + return 0; +} diff --git a/Tests/SimpleExclude/dirC/dirA/t4.c b/Tests/SimpleExclude/dirC/dirA/t4.c new file mode 100644 index 000000000..7c36ca927 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/t4.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +#ifdef __CLASSIC_C__ +int main() +{ + int ac; + char*av[]; +#else + int main(int ac, char*av[]) + { +#endif + if(ac > 1000){return *av[0];} + printf("This is T4. This one should work.\n"); + return 0; + } + + diff --git a/Tests/SimpleExclude/dirC/dirA/t5.c b/Tests/SimpleExclude/dirC/dirA/t5.c new file mode 100644 index 000000000..1fba2127c --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirA/t5.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char* argv[]) +{ + Should not be build unless target directory A, B, or C are build; + return 5; +} diff --git a/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt b/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt new file mode 100644 index 000000000..ea4650c4a --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirB/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(t6 STATIC t6.c) + +add_library(t7 STATIC t7.c) +target_link_libraries(t7 t2) + diff --git a/Tests/SimpleExclude/dirC/dirB/t6.c b/Tests/SimpleExclude/dirC/dirB/t6.c new file mode 100644 index 000000000..e8877df60 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirB/t6.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int tlib6func() +{ + Should not be build unless target directory B, or C are build; + printf("This is T6\n"); + return 6; +} diff --git a/Tests/SimpleExclude/dirC/dirB/t7.c b/Tests/SimpleExclude/dirC/dirB/t7.c new file mode 100644 index 000000000..b95d3ec43 --- /dev/null +++ b/Tests/SimpleExclude/dirC/dirB/t7.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +extern int tlib2func(); + +int tlib7func() +{ + printf("This is T7\n"); + + if ( tlib2func() != 2 ) + { + fprintf(stderr, "Something wrong with T2\n"); + return 1; + } + + return 7; +} diff --git a/Tests/SimpleExclude/dirD/CMakeLists.txt b/Tests/SimpleExclude/dirD/CMakeLists.txt new file mode 100644 index 000000000..44b8c27b6 --- /dev/null +++ b/Tests/SimpleExclude/dirD/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(t8 STATIC t8.c) + +add_executable(t9 t9.c) +target_link_libraries(t9 t7) + +add_custom_target(t4_custom ALL) +add_dependencies(t4_custom t4) diff --git a/Tests/SimpleExclude/dirD/t8.c b/Tests/SimpleExclude/dirD/t8.c new file mode 100644 index 000000000..bddec6f7e --- /dev/null +++ b/Tests/SimpleExclude/dirD/t8.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int tlib8func() +{ + printf("This is T8\n"); + return 8; +} diff --git a/Tests/SimpleExclude/dirD/t9.c b/Tests/SimpleExclude/dirD/t9.c new file mode 100644 index 000000000..321014b17 --- /dev/null +++ b/Tests/SimpleExclude/dirD/t9.c @@ -0,0 +1,24 @@ +#include <stdio.h> + +extern int tlib7func(); + +#ifdef __CLASSIC_C__ +int main() +{ + int ac; + char*av[]; +#else + int main(int ac, char*av[]) + { +#endif + if(ac > 1000){return *av[0];} + printf("This is T9. This one should work.\n"); + + if ( tlib7func() != 7 ) + { + fprintf(stderr, "Something wrong with T7\n"); + return 1; + } + return 0; + } + diff --git a/Tests/SimpleExclude/run.cmake.in b/Tests/SimpleExclude/run.cmake.in new file mode 100644 index 000000000..8f83380c8 --- /dev/null +++ b/Tests/SimpleExclude/run.cmake.in @@ -0,0 +1,13 @@ +set(t4_name "\"@CMAKE_CURRENT_BINARY_DIR@${CFG_DIR}/t4\"") +exec_program("${t4_name}" RETURN_VALUE "t4_var") +message("T4 ${t4_name} resulted ${t4_var}") + +set(t9_name "\"@CMAKE_CURRENT_BINARY_DIR@${CFG_DIR}/t9\"") +exec_program("${t9_name}" RETURN_VALUE "t9_var") +message("T9 ${t9_name} resulted ${t9_var}") + +if ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) + message("Everything is good, Yoshimi won...") +else ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) + message(FATAL_ERROR "Yoshimi lost... The evil pink robots will take over the world") +endif ( "${t4_var}" EQUAL "0" AND "${t9_var}" EQUAL "0" ) |