blob: 28301994b0e54e2adef2beb246b2e7c908d5bc7b (
plain)
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
|
include(RunCMake)
function(run_TargetMessages case)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TargetMessages-${case}-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
set(RunCMake_TEST_OPTIONS "${ARGN}")
run_cmake(TargetMessages-${case})
run_cmake_command(TargetMessages-${case}-build ${CMAKE_COMMAND} --build .)
endfunction()
run_TargetMessages(ON)
run_TargetMessages(OFF)
run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON)
run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF)
function(run_VerboseBuild)
run_cmake(VerboseBuild)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build)
if(RunCMake_GENERATOR STREQUAL "Watcom WMake")
# wmake does not actually show the verbose output.
set(RunCMake-stdout-file VerboseBuild-build-watcom-stdout.txt)
endif()
run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first)
unset(RunCMake-stdout-file)
set(_backup_lang "$ENV{LANG}")
set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
if(MAKE_IS_GNU)
set(RunCMake-stdout-file VerboseBuild-nowork-gnu-stdout.txt)
set(ENV{LANG} "C")
set(ENV{LC_MESSAGES} "C")
endif()
run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose)
set(ENV{LANG} "${_backup_lang}")
set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
endfunction()
run_VerboseBuild()
function(run_VerboseBuildShort)
run_cmake(VerboseBuildShort)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuildShort-build)
if(RunCMake_GENERATOR STREQUAL "Watcom WMake")
# wmake does not actually show the verbose output.
set(RunCMake-stdout-file VerboseBuildShort-build-watcom-stdout.txt)
endif()
run_cmake_command(VerboseBuildShort-build ${CMAKE_COMMAND} --build . -v --clean-first)
unset(RunCMake-stdout-file)
set(_backup_lang "$ENV{LANG}")
set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
if(MAKE_IS_GNU)
set(RunCMake-stdout-file VerboseBuildShort-nowork-gnu-stdout.txt)
set(ENV{LANG} "C")
set(ENV{LC_MESSAGES} "C")
endif()
run_cmake_command(VerboseBuildShort-nowork ${CMAKE_COMMAND} --build . --verbose)
set(ENV{LANG} "${_backup_lang}")
set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
endfunction()
run_VerboseBuildShort()
run_cmake(IncludeRegexSubdir)
function(run_MakefileConflict)
run_cmake(MakefileConflict)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MakefileConflict-build)
run_cmake_command(MakefileConflict-build ${CMAKE_COMMAND} --build . --target Custom)
endfunction()
run_MakefileConflict()
function(run_CMP0113 val)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0113-${val}-build)
run_cmake(CMP0113-${val})
set(RunCMake_TEST_NO_CLEAN 1)
set(_backup_lang "$ENV{LANG}")
set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
if(MAKE_IS_GNU)
set(RunCMake-stderr-file CMP0113-${val}-build-gnu-stderr.txt)
set(ENV{LANG} "C")
set(ENV{LC_MESSAGES} "C")
endif()
run_cmake_command(CMP0113-${val}-build ${CMAKE_COMMAND} --build .)
set(ENV{LANG} "${_backup_lang}")
set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
endfunction()
if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
run_CMP0113(WARN)
run_CMP0113(OLD)
run_CMP0113(NEW)
endif()
function(detect_jobserver_present)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DetectJobServer-present-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS "-DDETECT_JOBSERVER=${DETECT_JOBSERVER}")
run_cmake(DetectJobServer-present)
run_cmake_command(DetectJobServer-present-parallel-build ${CMAKE_COMMAND} --build . -j4)
endfunction()
function(run_make_rule case rule job_count)
run_cmake_command(${case}-${rule}-j${job_count}
${RunCMake_MAKE_PROGRAM} -f "${RunCMake_SOURCE_DIR}/${case}.make" ${rule} -j${job_count}
CMAKE_COMMAND="${CMAKE_COMMAND}" CMAKE_CTEST_COMMAND="${CMAKE_CTEST_COMMAND}"
)
endfunction()
function(run_CTestJobServer)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CTestJobServer-build)
run_cmake(CTestJobServer)
set(RunCMake_TEST_NO_CLEAN 1)
# Spoof a number of processors to make sure jobserver integration is unbounded.
set(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING} 1)
run_make_rule(CTestJobServer NoPipe 2)
run_make_rule(CTestJobServer NoTests 2)
run_make_rule(CTestJobServer Tests 2)
run_make_rule(CTestJobServer Tests 3)
unset(ENV{__CTEST_FAKE_PROCESSOR_COUNT_FOR_TESTING)
endfunction()
# Jobservers are currently only supported by GNU makes, except MSYS2 make
if(MAKE_IS_GNU AND NOT RunCMake_GENERATOR MATCHES "MSYS Makefiles")
detect_jobserver_present()
if(UNIX)
run_CTestJobServer()
endif()
endif()
if(MAKE_IS_GNU)
# In GNU makes, `JOB_SERVER_AWARE` support is implemented by prefixing
# commands with the '+' operator.
run_cmake(GNUMakeJobServerAware)
endif()
|