@@ -201,6 +201,8 @@ foreach(_test ${_tests})
201201 set (_use_test OFF )
202202 endif ()
203203
204+ # Check whether the test satisfies its conditions. The following
205+ # modifies _use_test as necessary:
204206 SHOULD_ENABLE_TEST(${CMAKE_CURRENT_SOURCE_DIR} /${_testname} .prm)
205207
206208 if (_use_test)
@@ -235,18 +237,15 @@ foreach(_test ${_tests})
235237 # output directory of this test. MAKE_DIRECTORY then does a `mkdir -p`.
236238 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /output -${_testname} )
237239
238- file (GLOB_RECURSE _outputs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} / ${_testname} /
239- ${CMAKE_CURRENT_SOURCE_DIR} /${_testname} /[a-zA-Z0-9]*)
240- foreach (_output ${_outputs} )
240+ file (GLOB_RECURSE _outputs
241+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} /${_testname} /
242+ ${CMAKE_CURRENT_SOURCE_DIR} / ${_testname} /[a-zA-Z0-9]* )
241243
242- # get the directory name we should work on; for cmake <2.8.11, the
243- # subcommand was PATH (legacy), for everything after we can use
244- # DIRECTORY
245- if (${CMAKE_VERSION} VERSION_LESS "2.8.12" )
246- get_filename_component (_dir ${_output} PATH )
247- else ()
248- get_filename_component (_dir ${_output} DIRECTORY )
249- endif ()
244+ # For each of the collected output files under tests/, see if
245+ # they have a directory component and if so, create that directory
246+ # also in the runtime directory under the current build directory:
247+ foreach (_output ${_outputs} )
248+ get_filename_component (_dir ${_output} DIRECTORY )
250249 if (NOT ${_dir} STREQUAL "" )
251250 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /output -${_testname} /${_dir} )
252251 endif ()
0 commit comments