File: GetPrerequisitesTest.cmake.in

package info (click to toggle)
cmake 2.8.11.1-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 37,056 kB
  • sloc: cpp: 157,219; ansic: 137,155; yacc: 3,254; sh: 2,745; xml: 2,483; lex: 1,028; lisp: 215; python: 199; objc: 134; f90: 105; perl: 99; fortran: 93; makefile: 65; tcl: 55; asm: 28; php: 25; ruby: 22; java: 20
file content (159 lines) | stat: -rw-r--r-- 5,484 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Test of the functions in the CMake Modules file:
#
include(GetPrerequisites)

set(CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
set(CMAKE_CONFIGURATION_TYPES "@CMAKE_CONFIGURATION_TYPES@")
set(CMAKE_EXECUTABLE_SUFFIX "@CMAKE_EXECUTABLE_SUFFIX@")


message(STATUS "=============================================================================")
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
message(STATUS "")
message(STATUS "CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}'")
message(STATUS "CMAKE_CONFIGURATION_TYPES='${CMAKE_CONFIGURATION_TYPES}'")
message(STATUS "CMAKE_EXECUTABLE_SUFFIX='${CMAKE_EXECUTABLE_SUFFIX}'")
message(STATUS "CTEST_CONFIGURATION_TYPE='${CTEST_CONFIGURATION_TYPE}'")
message(STATUS "")


function(stresstest_list_prerequisites file)
  message(STATUS "=============================================================================")
  message(STATUS "stresstest_list_prerequisites file='${file}'")
  message(STATUS "")

  get_filename_component(file_full "${file}" ABSOLUTE)

  message(STATUS "list_prerequisites '${file_full}' 0 0 0")
  list_prerequisites("${file_full}" 0 0 0)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 0 0 1")
  list_prerequisites("${file_full}" 0 0 1)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 0 1 0")
  list_prerequisites("${file_full}" 0 1 0)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 0 1 1")
  list_prerequisites("${file_full}" 0 1 1)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 1 0 0")
  list_prerequisites("${file_full}" 1 0 0)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 1 0 1")
  list_prerequisites("${file_full}" 1 0 1)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 1 1 0")
  list_prerequisites("${file_full}" 1 1 0)
  message(STATUS "")

  message(STATUS "list_prerequisites '${file_full}' 1 1 1")
  list_prerequisites("${file_full}" 1 1 1)
  message(STATUS "")

  message(STATUS "=============================================================================")
  message(STATUS "")
endfunction()


function(test_cmake_executables)
  message(STATUS "=============================================================================")
  message(STATUS "Loop over all executable files in the same directory with CMake")
  message(STATUS "")

  get_filename_component(cmake_bin_dir "${CMAKE_COMMAND}" PATH)
  list_prerequisites_by_glob(GLOB "${cmake_bin_dir}/*" 0 0 1)
endfunction()


message(STATUS "=============================================================================")
message(STATUS "Simplest test - list all the direct prerequisites of CMake itself")
message(STATUS "")
list_prerequisites("${CMAKE_COMMAND}" 0 0 1)
message(STATUS "")

message(STATUS "=============================================================================")
string(LENGTH "$ENV{PATH}" PATH_LENGTH_BEGIN)
message(STATUS "Begin PATH length is: ${PATH_LENGTH_BEGIN}")
message(STATUS "")


# Leave the code for these tests in here, but turn them off by default... they
# take longer than they're worth during development...
#
set(do_testdefaults 0)
if(do_testdefaults)
  message(STATUS "=============================================================================")
  message(STATUS "Test default argument values to list_prerequisites function...")
  message(STATUS "")
  list_prerequisites("${CMAKE_COMMAND}")
  message(STATUS "")
endif()


set(do_stresstest 0)
if(do_stresstest)
  message(STATUS "=============================================================================")
  message(STATUS "stresstest_list_prerequisites with CMake itself...")
  message(STATUS "")
  stresstest_list_prerequisites("${CMAKE_COMMAND}")
  message(STATUS "")
endif()


test_cmake_executables()


message(STATUS "=============================================================================")
message(STATUS "Test overriding 'gp_tool' with bogus value")
message(STATUS "")
set(gp_tool "bogus")
list_prerequisites("${CMAKE_COMMAND}" 0 0 0)
set(gp_tool)
message(STATUS "")


message(STATUS "=============================================================================")
message(STATUS "Test overriding 'gp_tool' with value unlikely to be found")
message(STATUS "")
if(APPLE)
  set(gp_tool "dumpbin")
else()
  set(gp_tool "otool")
endif()
set(gp_cmd "gp_cmd-NOTFOUND")
list_prerequisites("${CMAKE_COMMAND}" 0 0 0)
set(gp_cmd)
set(gp_tool)
message(STATUS "")


message(STATUS "=============================================================================")
message(STATUS "All variables: (Make sure functions/macros are not leaving stuff around...")
message(STATUS "                Only variables predefined by CMake and defined in this")
message(STATUS "                test script file should be listed here...)")
message(STATUS "")
get_cmake_property(vs VARIABLES)
foreach(v ${vs})
  message(STATUS "${v}='${${v}}'")
endforeach()
message(STATUS "")

message(STATUS "=============================================================================")
string(LENGTH "$ENV{PATH}" PATH_LENGTH_END)
message(STATUS "Final PATH length is: ${PATH_LENGTH_END}")

if(PATH_LENGTH_END GREATER ${PATH_LENGTH_BEGIN})
    message(FATAL_ERROR "list_prerequisties is endlessly appending the path of gp_tool to the PATH.")
endif()
message(STATUS "")


message(STATUS "=============================================================================")
message(STATUS "End of test")
message(STATUS "")