Handle the case when a glob pattern is in .cmd

In that case, CMake must use globbing to interpret the content of the
.cmd file.
This commit is contained in:
Laurent Rineau 2016-08-23 14:34:54 +02:00
parent 545e80f18e
commit 0a88180b51
1 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,24 @@
function(expand_list_with_globbing list_name)
set(input_list ${${list_name}})
# message(STATUS "expand_list_with_globbing(${list_name}), ${list_name} is: ${input_list}")
list(LENGTH input_list list_lenght)
math(EXPR list_last_n "${list_lenght} - 1")
set(output_list)
foreach(n RANGE ${list_last_n})
# message(STATUS "n=${n}")
list(GET input_list ${n} item_n)
# message(STATUS "argument ${n} is ${item_n}")
if(item_n MATCHES ".*\\*.*")
file(GLOB files RELATIVE ${CGAL_CURRENT_SOURCE_DIR} ${item_n})
list(APPEND output_list ${files})
else()
list(APPEND output_list ${item_n})
endif()
# message(STATUS " new value of the output list: ${output_list}")
endforeach()
set(${list_name} ${output_list} PARENT_SCOPE)
endfunction()
function(create_single_source_cgal_program firstfile )
if(NOT IS_ABSOLUTE "${firstfile}")
@ -41,6 +62,7 @@ function(create_single_source_cgal_program firstfile )
# message(STATUS " args: ${CMD_LINE_ARGS}")
list(APPEND ARGS ${CMD_LINE_ARGS})
endforeach()
expand_list_with_globbing(ARGS)
endif()
# message(STATUS "add test: ${exe_name} ${ARGS}")
add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS})