@@ -47,15 +47,18 @@ if(NOT Boost_FOUND)
47
47
find_package (Boost 1.34.0 QUIET )
48
48
endif ()
49
49
if ("${Boost_VERSION} 0" LESS "1034000" )
50
- set (_shared_msg "NOTE: boost::test-based targets and tests cannot "
50
+ set (_shared_msg
51
+ "NOTE: boost::test-based targets and tests cannot "
51
52
"be added: boost >= 1.34.0 required but not found. "
52
53
"(found: '${Boost_VERSION} '; want >=103400) " )
53
54
if (BUILD_TESTING)
54
- message (FATAL_ERROR ${_shared_msg}
55
+ message (FATAL_ERROR
56
+ ${_shared_msg}
55
57
"You may disable BUILD_TESTING to continue without the "
56
58
"tests." )
57
59
else ()
58
- message (STATUS ${_shared_msg}
60
+ message (STATUS
61
+ ${_shared_msg}
59
62
"BUILD_TESTING disabled, so continuing anyway." )
60
63
endif ()
61
64
endif ()
@@ -79,7 +82,9 @@ if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
79
82
set (_boostConfig "BoostTestTargetsIncluded.h" )
80
83
endif ()
81
84
get_filename_component (_moddir ${CMAKE_CURRENT_LIST_FILE} PATH )
82
- configure_file ("${_moddir} /${_boostConfig} " "${CMAKE_CURRENT_BINARY_DIR} /BoostTestTargetConfig.h" COPYONLY )
85
+ configure_file ("${_moddir} /${_boostConfig} "
86
+ "${CMAKE_CURRENT_BINARY_DIR} /BoostTestTargetConfig.h"
87
+ COPYONLY )
83
88
include_directories ("${CMAKE_CURRENT_BINARY_DIR} " )
84
89
endif ()
85
90
@@ -89,8 +94,14 @@ function(add_boost_test _name)
89
94
endif ()
90
95
if ("${CMAKE_VERSION} " VERSION_LESS "2.8.0" )
91
96
if (NOT "${_boost_test_cmakever_pestered} x" EQUALS "${CMAKE_VERSION} x" )
92
- message (STATUS "Not adding boost::test targets - CMake 2.8.0 or newer required, using ${CMAKE_VERSION} " )
93
- set (_boost_test_cmakever_pestered "${CMAKE_VERSION} " CACHE INTERNAL "" FORCE)
97
+ message (STATUS
98
+ "Not adding boost::test targets - CMake 2.8.0 or newer required, using ${CMAKE_VERSION} " )
99
+ set (_boost_test_cmakever_pestered
100
+ "${CMAKE_VERSION} "
101
+ CACHE
102
+ INTERNAL
103
+ ""
104
+ FORCE)
94
105
endif ()
95
106
return ()
96
107
endif ()
@@ -128,7 +139,8 @@ function(add_boost_test _name)
128
139
endif ()
129
140
130
141
if (NOT SOURCES )
131
- message (FATAL_ERROR "Syntax error in use of add_boost_test: at least one source file required!" )
142
+ message (FATAL_ERROR
143
+ "Syntax error in use of add_boost_test: at least one source file required!" )
132
144
endif ()
133
145
134
146
if (Boost_FOUND AND NOT "${Boost_VERSION} 0" LESS "1034000" )
@@ -145,8 +157,11 @@ function(add_boost_test _name)
145
157
elseif ("${thefile} " MATCHES ".*boost/test/included/unit_test.hpp.*" )
146
158
set (includeType INCLUDED)
147
159
set (includeFileLoc ${src} )
148
- set (_boosttesttargets_libs) # clear this out - linking would be a bad idea
149
- if (NOT "${thefile} " MATCHES ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*" )
160
+ set (_boosttesttargets_libs) # clear this out - linking would be a bad idea
161
+ if (NOT
162
+ "${thefile} "
163
+ MATCHES
164
+ ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*" )
150
165
message ("Please replace the include line in ${src} with this alternate include line instead:" )
151
166
message (" \# include <BoostTestTargetConfig.h>" )
152
167
message ("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)" )
@@ -157,7 +172,8 @@ function(add_boost_test _name)
157
172
158
173
if (NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType} " )
159
174
if ("includeType" STREQUAL "CONFIGURED" )
160
- message (STATUS "Test '${_name} ' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc} )" )
175
+ message (STATUS
176
+ "Test '${_name} ' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc} )" )
161
177
elseif ("${includeType} " STREQUAL "INCLUDED" )
162
178
message ("In test '${_name} ': ${includeFileLoc} uses the 'included' form of the boost unit test framework." )
163
179
else ()
@@ -167,7 +183,12 @@ function(add_boost_test _name)
167
183
message ("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)" )
168
184
endif ()
169
185
endif ()
170
- set (_boostTestTargetsNagged${_name} "${includeType} " CACHE INTERNAL "" FORCE)
186
+ set (_boostTestTargetsNagged${_name}
187
+ "${includeType} "
188
+ CACHE
189
+ INTERNAL
190
+ ""
191
+ FORCE)
171
192
172
193
173
194
if (RESOURCES)
@@ -177,7 +198,10 @@ function(add_boost_test _name)
177
198
# Generate a unique target name, using the relative binary dir
178
199
# and provided name. (transform all / into _ and remove all other
179
200
# non-alphabet characters)
180
- file (RELATIVE_PATH targetpath "${CMAKE_BINARY_DIR} " "${CMAKE_CURRENT_BINARY_DIR} " )
201
+ file (RELATIVE_PATH
202
+ targetpath
203
+ "${CMAKE_BINARY_DIR} "
204
+ "${CMAKE_CURRENT_BINARY_DIR} " )
181
205
string (REGEX REPLACE "[^A-Za-z/_]" "" targetpath "${targetpath} " )
182
206
string (REPLACE "/" "_" targetpath "${targetpath} " )
183
207
@@ -194,11 +218,7 @@ function(add_boost_test _name)
194
218
endif ()
195
219
196
220
if (RESOURCES)
197
- set_property (TARGET
198
- ${_target_name}
199
- PROPERTY
200
- RESOURCE
201
- ${RESOURCES} )
221
+ set_property (TARGET ${_target_name} PROPERTY RESOURCE ${RESOURCES} )
202
222
copy_resources_to_build_tree(${_target_name} )
203
223
endif ()
204
224
@@ -215,30 +235,32 @@ function(add_boost_test _name)
215
235
set (_test_command ${_target_name} )
216
236
endif ()
217
237
218
- if (TESTS AND ("${Boost_VERSION} " VERSION_GREATER "103799" ))
238
+ if (TESTS AND ( "${Boost_VERSION} " VERSION_GREATER "103799" ))
219
239
foreach (_test ${TESTS} )
220
- add_test (NAME ${_name} -${_test}
240
+ add_test (NAME
241
+ ${_name} -${_test}
221
242
COMMAND
222
- ${_test_command}
223
- --run_test=${_test}
224
- ${Boost_TEST_FLAGS} )
243
+ ${_test_command}
244
+ --run_test=${_test}
245
+ ${Boost_TEST_FLAGS} )
225
246
if (FAIL_REGULAR_EXPRESSION )
226
- set_tests_properties (${_name} -${_test}
227
- PROPERTIES
228
- FAIL_REGULAR_EXPRESSION
229
- "${FAIL_REGULAR_EXPRESSION} " )
247
+ set_tests_properties (${_name} -${_test}
248
+ PROPERTIES
249
+ FAIL_REGULAR_EXPRESSION
250
+ "${FAIL_REGULAR_EXPRESSION} " )
230
251
endif ()
231
252
endforeach ()
232
253
else ()
233
- add_test (NAME ${_name} -boost_test
254
+ add_test (NAME
255
+ ${_name} -boost_test
234
256
COMMAND
235
- ${_test_command}
236
- ${Boost_TEST_FLAGS} )
257
+ ${_test_command}
258
+ ${Boost_TEST_FLAGS} )
237
259
if (FAIL_REGULAR_EXPRESSION )
238
- set_tests_properties (${_name} -${_test}
239
- PROPERTIES
240
- FAIL_REGULAR_EXPRESSION
241
- "${FAIL_REGULAR_EXPRESSION} " )
260
+ set_tests_properties (${_name} -${_test}
261
+ PROPERTIES
262
+ FAIL_REGULAR_EXPRESSION
263
+ "${FAIL_REGULAR_EXPRESSION} " )
242
264
endif ()
243
265
endif ()
244
266
0 commit comments